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, when the API is down #79

Closed
Wegi opened this issue Jul 22, 2016 · 1 comment
Closed

JSONDecodeError, when the API is down #79

Wegi opened this issue Jul 22, 2016 · 1 comment

Comments

@Wegi
Copy link

Wegi commented Jul 22, 2016

This error gets thrown, when the Servers are down:

if not self._auth_provider.login(username, password):
  File "/home/wegi/.virtualenvs/poke-cruncher/src/pgoapi/pgoapi/auth_ptc.py", line 56, in login
    jdata = json.loads(r.content.decode('utf-8'))
  File "/usr/lib64/python3.5/json/__init__.py", line 319, in loads
    return _default_decoder.decode(s)
  File "/usr/lib64/python3.5/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib64/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 3 column 1 (char 2)

Maybe add a softfail or a specific exception which can be caught, when server responses are abnormal.

@tejado
Copy link
Owner

tejado commented Jul 29, 2016

should be implemented now.

@tejado tejado closed this as completed Jul 29, 2016
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

2 participants