basecrm-python icon indicating copy to clipboard operation
basecrm-python copied to clipboard

KeyError: 'errors' in RequestError.__init__

Open mark-mishyn opened this issue 7 years ago • 2 comments

Hello. Sometimes I had the following error when I call basecrm.services.ContactsService.create(). Package version is basecrm-1.1.1

HTTP status is 404 and errors_payload is {"error": "not_found"}

File "/opt/python/run/venv/local/lib/python3.4/site-packages/basecrm/services.py" line 180 in create _, _, contact = self.http_client.post("/contacts", body=attributes)

File "/opt/python/run/venv/local/lib/python3.4/site-packages/basecrm/http_client.py" line 53 in post return self.request('post', url, body=body, **kwargs)

File "/opt/python/run/venv/local/lib/python3.4/site-packages/basecrm/http_client.py" line 138 in request self.handle_error_response(resp)

File "/opt/python/run/venv/local/lib/python3.4/site-packages/basecrm/http_client.py" line 161 in handle_error_response raise RequestError(resp_code, errors)

File "/opt/python/run/venv/local/lib/python3.4/site-packages/basecrm/errors.py" line 47 in init for error_envelope in errors_payload['errors']]

KeyError: 'errors'`

Let me know If I should provide more information or if the issue is already solved.

mark-mishyn avatar Jul 31 '17 10:07 mark-mishyn

Hi @mark-mishyn, I was not able to reproduce this on the newest version (1.2.3). Please update your client and let me know if you still get this error, otherwise I'm gonna close this issue.

piotr-szczesniak avatar Oct 27 '17 17:10 piotr-szczesniak

Hello @piotr-szczesniak

Many thanks for your reply. I will use newest version. But I got this issue not often, 1 occurrence per 1-2 months, so I'm not sure if issue really solved.

mark-mishyn avatar Nov 16 '17 11:11 mark-mishyn