You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm having a transient issue with the library. Every so often, the get call below fails. Waiting a few seconds and retrying to call usually fixes it so I suspect the remote server is responding with something unexpected. Clients can easily catch and retry, but it would be nice if the library gracefully failed and gave consumers a clearer picture of the cause so they can adapt appropriately.
start=(datetime.datetime.now() - datetime.timedelta(hours=1)).isoformat()
params = urllib.urlencode({'start': start})
res = api.get("/v3/reporting/logs.json?{0}".format(params))
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Library/Python/2.7/site-packages/maxcdn/maxcdn.py", line 40, in get
**kwargs).json()
File "/Library/Python/2.7/site-packages/requests/models.py", line 797, in json
return json.loads(self.text, **kwargs)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/__init__.py", line 338, in loads
return _default_decoder.decode(s)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 365, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/json/decoder.py", line 383, in raw_decode
raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
@kdmny I agree. I'm wondering if perhaps it's an empty response or something like that. I'll take a look when I have a sec and get back to you. Cheers!
So that's not it. The next step will probably be to update the module to include better error checking from the server, so the error can be passed on to support@maxcdn.com for server side debugging.
So I've released these changes. See: https://github.com/MaxCDN/python-maxcdn/releases/tag/v0.0.6 for details. I'm going to close this issue, although I understand the underlying issues hasn't really been fixed. With the additional error logging you should be able to grab information about the real issue. You can then either open a new request here, if it's related to this package, or send an email to support@maxcdn.com, if it's API / server related.
Let me know if you have any other questions, comments, etc.
Activity
jmervine commentedon Dec 17, 2014
@kdmny I agree. I'm wondering if perhaps it's an empty response or something like that. I'll take a look when I have a sec and get back to you. Cheers!
jmervine commentedon Dec 17, 2014
Empty response should look like this:
So that's not it. The next step will probably be to update the module to include better error checking from the server, so the error can be passed on to support@maxcdn.com for server side debugging.
jmervine commentedon Dec 17, 2014
@kdmny (cc @jdorfman) What would your preferred handling be here?
{ 'error': raw_body, 'status_code': status_code }curlstyle response return in place of parsed json, e.g.:jmervine commentedon Dec 17, 2014
I'm thinking a custom
ValueError, something like:See pull request #12
Merge pull request #12 from /issues/11
jmervine commentedon Dec 19, 2014
@kdmny (cc/ @jimaek)
So I've released these changes. See: https://github.com/MaxCDN/python-maxcdn/releases/tag/v0.0.6 for details. I'm going to close this issue, although I understand the underlying issues hasn't really been fixed. With the additional error logging you should be able to grab information about the real issue. You can then either open a new request here, if it's related to this package, or send an email to support@maxcdn.com, if it's API / server related.
Let me know if you have any other questions, comments, etc.
Cheers,
J