Skip to content

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

@cardonator

Description

@cardonator

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions