From 823293b1ac49da00287db0b2116083198cb1a96b Mon Sep 17 00:00:00 2001 From: Christopher Singley Date: Wed, 18 Nov 2020 15:19:07 -0600 Subject: [PATCH] Client.OFXClient.http_headers - add Accept application/xml MIME type Apparently Amex's OFX server insists that the HTTP Accept header contan application/xml with some sort of quality rating - ANY quality rating, it would seem. --- ofxtools/Client.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ofxtools/Client.py b/ofxtools/Client.py index 382f83a..30720dc 100755 --- a/ofxtools/Client.py +++ b/ofxtools/Client.py @@ -263,7 +263,9 @@ def http_headers(self) -> Dict[str, str]: return { "User-Agent": "", "Content-type": mimetype, - "Accept": "*/*, {}".format(mimetype), + # Apparently Amex is unhappy unless it sees a MIME type of application/xml + # with some quality rating - ANY quality rating, it seems. + "Accept": "*/*, {}, application/xml;q=0.9".format(mimetype), } def dtclient(self) -> datetime.datetime: