librato / python-librato

A Python wrapper for the Librato Metrics API.
Other
72 stars 31 forks source link

403 error #118

Closed tcroiset closed 8 years ago

tcroiset commented 8 years ago

Hi, Some of my calls to submit metrics fail It concerns calls with many (~200) metrics sent. It looks like the api returns 403 error (why?), and the parsing of the error fails.

bests,

Traceback (most recent call last): File "/home/vmagent/app/api/views/other.py", line 248, in post q.submit() File "/usr/local/lib/python2.7/dist-packages/librato/queue.py", line 93, in submit self.connection._mexe("metrics", method="POST", query_props=c) File "/usr/local/lib/python2.7/dist-packages/librato/init.py", line 180, in _mexe resp_data, success, backoff = self._process_response(resp, backoff) File "/usr/local/lib/python2.7/dist-packages/librato/init.py", line 160, in _process_response raise exceptions.get(resp.status, resp_data) File "/usr/local/lib/python2.7/dist-packages/librato/exceptions.py", line 137, in get return CODEScode File "/usr/local/lib/python2.7/dist-packages/librato/exceptions.py", line 119, in init ClientError.init(self, 403, msg) File "/usr/local/lib/python2.7/dist-packages/librato/exceptions.py", line 32, in init Exception.init(self, self.error_message()) File "/usr/local/lib/python2.7/dist-packages/librato/exceptions.py", line 35, in error_message return "[%s] %s" % (self.code, self._parse_error_message()) File "/usr/local/lib/python2.7/dist-packages/librato/exceptions.py", line 71, in _parse_error_message payload = self.error_payload['errors'] KeyError: 'errors'

drio commented 8 years ago

Hi @tcroiset,

It seems we are receiving an unexpected error payload. Could you please try your code using this branch? It should report the error payload so we can identify what the problem is with the request.

Alternatively, I can try that on my end if you send me the code you are using.

jderrett commented 8 years ago

Should be fixed in #122