Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSONDecodeError on Login #2

Closed
coreyjackwilson opened this issue Aug 19, 2018 · 4 comments
Closed

JSONDecodeError on Login #2

coreyjackwilson opened this issue Aug 19, 2018 · 4 comments

Comments

@coreyjackwilson
Copy link

coreyjackwilson commented Aug 19, 2018

@kevinjqiu,

Summary

  • Tried to login using the example code, getting a JSON Decode Error
  • Maybe the login flow has changed?

Steps to Reproduce

  1. Use example code in /examples
  2. User InteractiveSecretProvider()
  3. Enter user name
  4. Enter correct secret question answer

Expected Result

  1. A session is created

Actual Result

  1. JSON Decode Error

Code

import logging
import pdb
import datetime
from tangerine import TangerineClient, InteractiveSecretProvider
from tangerine.exceptions import UnsupportedAccountTypeForDownload

FROM = datetime.date(2017, 6, 1)
TO = datetime.date(2017, 11, 2)

def __test__():
    pass


if __name__ == '__main__':
    logging.basicConfig(level=logging.INFO)
    secret_provider = InteractiveSecretProvider()
    client = TangerineClient(secret_provider)
    with client.login():
        accounts = [
            acct for acct in client.list_accounts()
            if acct['type'] != 'CREDIT_CARD'
        ]
        for acct in accounts:
            try:
                client.download_ofx(acct, FROM, TO)
            except UnsupportedAccountTypeForDownload as e:
                print(e)

Stack

Traceback (most recent call last):
  File "main.py", line 20, in <module>
    client = TangerineClient(secret_provider)
  File "/Users/XXXX/.pyenv/versions/3.5.0/lib/python3.5/contextlib.py", line 59, in __enter__
    return next(self.gen)
  File "/Users/XXXX/.pyenv/versions/3.5.0/lib/python3.5/site-packages/tangerine/client.py", line 46, in login
    self.login_flow.start()
  File "/Users/XXXX/.pyenv/versions/3.5.0/lib/python3.5/site-packages/tangerine/login.py", line 89, in start
    phrase = self._get_pin_phrase()
  File "/Users/XXXX/.pyenv/versions/3.5.0/lib/python3.5/site-packages/tangerine/login.py", line 59, in _get_pin_phrase
    return r.json()['MessageBody']['Phrase']
  File "/Users/XXXX/.pyenv/versions/3.5.0/lib/python3.5/site-packages/requests/models.py", line 892, in json
    return complexjson.loads(self.text, **kwargs)
  File "/Users/XXXX/.pyenv/versions/3.5.0/lib/python3.5/json/__init__.py", line 319, in loads
    return _default_decoder.decode(s)
  File "/Users/XXXX/.pyenv/versions/3.5.0/lib/python3.5/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/Users/XXXX/.pyenv/versions/3.5.0/lib/python3.5/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

EDIT: code formatting

@kevinjqiu
Copy link
Owner

Hi @coreyjackwilson

It still work for my account. Maybe the tangerine server was doing maintenance at the time and returned a splash page? It's hard to say without looking at the response. If you're still experiencing this issue, could you please increase the log level to 'DEBUG' here, and paste the output (obfuscate any personal identifiable information of course)?

like so:

    logging.basicConfig(level=logging.DEBUG)

@kevinjqiu
Copy link
Owner

@coreyjackwilson Feel free to reopen if it's still an issue for you.

@coreyjackwilson
Copy link
Author

I was able to track it down to an issue with my login creds. If I have time, i submit a PR to expose the message instead of just failing on JSONDecode. Thanks for the swift response @kevinjqiu

@normcyr
Copy link

normcyr commented Oct 27, 2019

@coreyjackwilson I get the same error as you described. Would you mind sharing your workaround?

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

No branches or pull requests

3 participants