Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

No JSON object could be decoded #11

Copy link
Copy link
@kdmny

Description

@kdmny
Issue body actions

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Morty Proxy This is a proxified and sanitized view of the page, visit original site.