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

Cannot iterate collection proxy for leads/contacts. #246

Open
sktse opened this issue Aug 1, 2023 · 0 comments
Open

Cannot iterate collection proxy for leads/contacts. #246

sktse opened this issue Aug 1, 2023 · 0 comments

Comments

@sktse
Copy link

sktse commented Aug 1, 2023

Hello,

I am attempting to search for an existing lead via an email address. The API request goes in successfully but iterating through the results results in an KeyError

I am using version: python-intercom==3.1.0

Code sample to reproduce

intercom_client = Client(personal_access_token=api_key)
intercom_leads = intercom_client.leads.find_all(email="test@email.com")
for lead in intercom_leads:
    pprint(lead)

Produces the unhandled exception

    def get_page(self, url, params={}):
        # get a page of results
        # from intercom import Intercom
    
        # if there is no url stop iterating
        if url is None:
            raise StopIteration
    
        response = self.client.get(url, params)
        if response is None:
            raise HttpError('Http Error - No response entity returned')
    
>       collection = response[self.collection]
E       KeyError: 'contacts'

/usr/local/lib/python3.10/site-packages/intercom/collection_proxy.py:85: KeyError
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

1 participant