Skip to content

JSONDecodeError while executing a search #2

@fbaldi6

Description

@fbaldi6

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions