Skip to content
This repository has been archived by the owner on Dec 11, 2023. It is now read-only.

No JSON object could be decoded #89

Open
Fkawala opened this issue Jun 30, 2015 · 3 comments
Open

No JSON object could be decoded #89

Fkawala opened this issue Jun 30, 2015 · 3 comments

Comments

@Fkawala
Copy link

Fkawala commented Jun 30, 2015

Hi,

I have trouble using queues (python-librato/librato/queue.py). I create the queue as demonstrated in the docs (see below). The queue auto-submit fails with a ValueError exception that is raised when the response from the server is parsed.

Best,
François.

Minimum example:

LIBRATO_USER = '****'
LIBRATO_TOKEN = '****'
api = librato.connect(LIBRATO_USER, LIBRATO_TOKEN)
q = api.new_queue(auto_submit_count=1)
q.add('sdfsdf',1)

Error stack:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/librato/queue.py", line 61, in add
    self.submit()
  File "/usr/local/lib/python2.7/dist-packages/librato/queue.py", line 95, in submit
    self.connection._mexe("metrics", method="POST", query_props=c)
  File "/usr/local/lib/python2.7/dist-packages/librato/__init__.py", line 170, in _mexe
    resp_data, success, backoff = self._process_response(resp, backoff)
  File "/usr/local/lib/python2.7/dist-packages/librato/__init__.py", line 147, in _process_response
    resp_data = json.loads(body.decode(_getcharset(resp)))
  File "/usr/lib/python2.7/json/__init__.py", line 338, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python2.7/json/decoder.py", line 366, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python2.7/json/decoder.py", line 384, in raw_decode
    raise ValueError("No JSON object could be decoded")
ValueError: No JSON object could be decoded
@Fkawala
Copy link
Author

Fkawala commented Jul 1, 2015

The problem is related to the authentication. The content of the response that cause the ValueError is:

Credentials are required to access this resource.

@nextmat
Copy link
Contributor

nextmat commented Jul 1, 2015

@Fkawala Thanks for the report and update. The regular maintainers of this lib are out for the next few days (this is a Holiday week in the US), but they should be able to follow up in improving this case next week.

It sounds like it was an auth issue, were you able to get everything sorted in the meantime?

@Fkawala
Copy link
Author

Fkawala commented Jul 2, 2015

@nextmat Thanks for the update, that auth issue is solved.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants