Skip to content

Fix Discover Card 403 by manually ordering HTTP headers#37

Merged
captin411 merged 2 commits into
captin411:masterfrom
fanqiuwen:fix-discover-headers
Apr 21, 2017
Merged

Fix Discover Card 403 by manually ordering HTTP headers#37
captin411 merged 2 commits into
captin411:masterfrom
fanqiuwen:fix-discover-headers

Conversation

@fanqiuwen

Copy link
Copy Markdown
Contributor

Since mid February Discover Card has been giving 403 Permission Denied for OFX requests that previously worked. It was discovered on OFX Home Forum that Discover now requires a particular set of HTTP headers ordered in a particular way. This PR implements the fix.

@jantman

jantman commented Mar 7, 2017

Copy link
Copy Markdown
Contributor

I can confirm that this fix works for me, though I'm still hitting #15 unless I add a sleep to cli.py.

@albaguirre

Copy link
Copy Markdown

Umm this didn't work for me. Still getting 403s.

@fanqiuwen

Copy link
Copy Markdown
Contributor Author

@albaguirre The fix is still working for me.

I'm using ofxclient as a Python library, not a cli tool. For reference, here's a minimal version of my script that downloads Discover transactions successfully, given the changes in this PR.

from ofxclient import Institution, CreditCardAccount
discover_args = {
    'id': '7101',
    'org': 'Discover Financial Services',
    'url': 'https://ofx.discovercard.com',
    'username': 'SECRET',
    'password': 'SECRET',
    'client_args': {
        'app_id': 'QWIN',
        'app_version': '2200',
        'ofx_version': '102'
        }
    }
discover = CreditCardAccount(institution=Institution(**discover_args),
                             number='SECRET')
for tran in discover.transactions():
    print(tran.payee, tran.amount)

If this works for you and the cli doesn't, then it would be a separate issue.

@albaguirre

Copy link
Copy Markdown

@fanqiuwen Huh that snippet does indeed work. But CLI doesn't ... interesting.

@captin411 captin411 merged commit 7829515 into captin411:master Apr 21, 2017
@jantman

jantman commented Apr 22, 2017

Copy link
Copy Markdown
Contributor

Cool, thank you so much for merging! Any chance we could get a release uploaded to PyPI?

@captin411

captin411 commented Apr 22, 2017 via email

Copy link
Copy Markdown
Owner

jantman added a commit to jantman/biweeklybudget that referenced this pull request May 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants