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

Cannot iterate collection proxy for leads/contacts.

Open sktse opened this issue 2 years ago • 1 comments

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="[email protected]")
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

sktse avatar Aug 01 '23 20:08 sktse

Facing same error

rishav00a avatar Jun 15 '24 23:06 rishav00a