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

When API Key is recycled and 403s are returned, the library returns a KeyError #11

Open
cardonator opened this issue May 25, 2021 · 1 comment

Comments

@cardonator
Copy link

Relevant traceback:

 File "/usr/local/lib/python3.8/site-packages/activecampaign/contacts.py", line 16, in create_a_contact
    return self.client._post("/contacts", json=data)
  File "/usr/local/lib/python3.8/site-packages/activecampaign/client.py", line 37, in _post
    return self._request('POST', endpoint, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/activecampaign/client.py", line 54, in _request
    return self._parse(requests.request(method, self.BASE_URL + endpoint, headers=_headers, **kwargs))
  File "/usr/local/lib/python3.8/site-packages/activecampaign/client.py", line 57, in _parse
    if 'application/json' in response.headers['Content-Type']:
  File "/usr/local/lib/python3.8/site-packages/requests/structures.py", line 54, in __getitem__
    return self._store[key.lower()][1]
KeyError: 'content-type'

If the API returns a 403 response, the library should return an error response or throw an Exception indicating a Forbidden status.

@pkshahid
Copy link

pkshahid commented Oct 6, 2023

Relevant traceback:

 File "/usr/local/lib/python3.8/site-packages/activecampaign/contacts.py", line 16, in create_a_contact
    return self.client._post("/contacts", json=data)
  File "/usr/local/lib/python3.8/site-packages/activecampaign/client.py", line 37, in _post
    return self._request('POST', endpoint, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/activecampaign/client.py", line 54, in _request
    return self._parse(requests.request(method, self.BASE_URL + endpoint, headers=_headers, **kwargs))
  File "/usr/local/lib/python3.8/site-packages/activecampaign/client.py", line 57, in _parse
    if 'application/json' in response.headers['Content-Type']:
  File "/usr/local/lib/python3.8/site-packages/requests/structures.py", line 54, in __getitem__
    return self._store[key.lower()][1]
KeyError: 'content-type'

If the API returns a 403 response, the library should return an error response or throw an Exception indicating a Forbidden status.

Did you solve it?

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