Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JSONDecodeError while executing a search #2

Open
fbaldi6 opened this issue Aug 5, 2022 · 1 comment
Open

JSONDecodeError while executing a search #2

fbaldi6 opened this issue Aug 5, 2022 · 1 comment

Comments

@fbaldi6
Copy link

fbaldi6 commented Aug 5, 2022

Hello, I have been unable to use the API to perform searches since yesterday. Every time I get the same error: requests.exceptions.JSONDecodeError: Expecting value: line 5 column 1 (char 4)

Below is the test code I tried to use, taken directly from the API documentation.

rr = rocketreach.Gateway(api_key='{API_KEY}')
s = rr.person.search().filter(current_employer='Acme', current_title='CEO')
result = s.execute()
for person in result.people:
    print(person)

And below is the traceback of the exception that is thrown.

Traceback (most recent call last):
  File "/Users/user/PycharmProjects/CRM_lambda/venv/lib/python3.7/site-packages/requests/models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 5 column 1 (char 4)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/Users/user/PycharmProjects/rocketreach/test.py", line 5, in <module>
    result = s.execute()
  File "/Users/user/PycharmProjects/rocketreach/venv/lib/python3.7/site-packages/rocketreach/person_search.py", line 127, in execute
    return self.gateway.execute_search(self)
  File "/Users/user/PycharmProjects/rocketreach/venv/lib/python3.7/site-packages/rocketreach/person_gateway.py", line 156, in execute_search
    result = self.gateway.send(req)
  File "/Users/user/PycharmProjects/rocketreach/venv/lib/python3.7/site-packages/rocketreach/gateway.py", line 119, in send
    result = ErrorResult(req, res)
  File "/Users/user/PycharmProjects/rocketreach/venv/lib/python3.7/site-packages/rocketreach/result.py", line 24, in __init__
    self.errors = response.json()
  File "/Users/user/PycharmProjects/rocketreach/venv/lib/python3.7/site-packages/requests/models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 5 column 1 (char 4)

The version I have of rocketreach is 2.1.3 and the version of Python is 3.7.2.

Does anyone know why this problem occurs and how to solve it? Thank you

@punihaole
Copy link
Member

Can you post

$ pip freeze

This might be due to the version of requests package being incompatbile.

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

No branches or pull requests

2 participants