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
{{ message }}
This repository was archived by the owner on May 15, 2024. It is now read-only.
If the account or token is invalid, an expected response with status_code 401 is returned, but the reponse._content is a string Unauthorized, not the expected string {error: <message>}. Thus line 114 content = json.loads(response._content) in jupiterone/client.py will cause json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Reproduction
Set the account or token in the header to be an invalid value
Use a breakpoint to verify the response has status_code = 401 and ._content = "Unauthorized"
Or wrap the call to the client with try-except and verify the Exception has a doc attribute with "Unauthorized"
Verify that the exception trace stack looks like this:
| File "/usr/local/lib/python3.9/site-packages/jupiterone/client.py", line 203, in query_v1
| return self._cursor_query(
| File "/usr/local/lib/python3.9/site-packages/jupiterone/client.py", line 135, in _cursor_query
| response = self._execute_query(query=CURSOR_QUERY_V1, variables=variables)
| File "/usr/local/lib/python3.9/site-packages/retrying.py", line 49, in wrapped_f
| return Retrying(*dargs, **dkw).call(f, *args, **kw)
| File "/usr/local/lib/python3.9/site-packages/retrying.py", line 206, in call
| return attempt.get(self._wrap_exception)
| File "/usr/local/lib/python3.9/site-packages/retrying.py", line 247, in get
| six.reraise(self.value[0], self.value[1], self.value[2])
| File "/usr/local/lib/python3.9/site-packages/six.py", line 719, in reraise
| raise value
| File "/usr/local/lib/python3.9/site-packages/retrying.py", line 200, in call
| attempt = Attempt(fn(*args, **kwargs), attempt_number, False)
| File "/usr/local/lib/python3.9/site-packages/jupiterone/client.py", line 114, in _execute_query
| content = json.loads(response._content)
| File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
| return _default_decoder.decode(s)
| File "/usr/local/lib/python3.9/json/decoder.py", line 337, in decode
| obj, end = self.raw_decode(s, idx=_w(s, 0).end())
| File "/usr/local/lib/python3.9/json/decoder.py", line 355, in raw_decode
| raise JSONDecodeError("Expecting value", s, err.value) from None
| json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Environment
Version: jupiterone 0.2.0
The text was updated successfully, but these errors were encountered:
Description
If the account or token is invalid, an expected response with status_code 401 is returned, but the reponse._content is a string
Unauthorized
, not the expected string{error: <message>}
. Thus line 114content = json.loads(response._content)
in jupiterone/client.py will causejson.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
Reproduction
Environment
The text was updated successfully, but these errors were encountered: