-
Notifications
You must be signed in to change notification settings - Fork 145
Description
Hi, I'm running the following code and it fails consistently both in users and leads when it needs to page.
This happens in Python 2.7 or 3.0
for lead in intercom.leads.all(): print(lead.email)
for user in intercom.users.all(): print(user.email)
Error is:
Traceback
(most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/python_intercom-3.0b2-py3.5.egg/intercom/collection_proxy.py", line 52, in next
resource = six.next(self.resources)
StopIterationDuring handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/connection.py", line 142, in _new_conn
(self.host, self.port), self.timeout, **extra_kw)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/util/connection.py", line 67, in create_connection
for res in socket.getaddrinfo(host, port, 0, socket.SOCK_STREAM):
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/socket.py", line 732, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 8] nodename nor servname provided, or not knownDuring handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 578, in url open
chunked=chunked)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 351, in _make_request
self._validate_conn(conn)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 814, in _validate_conn
conn.connect()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/connection.py", line 254, in connect
conn = self._new_conn()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/connection.py", line 151, in _new_conn
self, "Failed to establish a new connection: %s" % e)
requests.packages.urllib3.exceptions.NewConnectionError: <requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x1033d75c0>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not knownDuring handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/adapters.py", line 403, in send
timeout=timeout
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/connectionpool.py", line 623, in url open
_stacktrace=sys.exc_info()[2])
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/packages/urllib3/util/retry.py", line 281, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
requests.packages.urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='api.intercom.iohttps', port=443): Max retries exceeded with url: //api.intercom.io/users?per_page=50&page=2 (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x1033d75c0>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known',))During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "CleanIntercomLeads.py", line 9, in
for lead in intercom.users.all():
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/python_intercom-3.0b2-py3.5.egg/intercom/collection_proxy.py", line 54, in next
self.get_next_page()
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/python_intercom-3.0b2-py3.5.egg/intercom/collection_proxy.py", line 71, in get_next_page
return self.get_page(self.next_page)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/python_intercom-3.0b2-py3.5.egg/intercom/collection_proxy.py", line 81, in get_page
response = self.client.get(url, params)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/python_intercom-3.0b2-py3.5.egg/intercom/client.py", line 89, in get
return self._execute_request(req, params)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/python_intercom-3.0b2-py3.5.egg/intercom/client.py", line 82, in _execute_request
result = request.execute(self.base_url, self._auth, params)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/python_intercom-3.0b2-py3.5.egg/intercom/request.py", line 23, in execute
return self.send_request_to_path(base_url, auth, params)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/python_intercom-3.0b2-py3.5.egg/intercom/request.py", line 57, in send_request_to_path
auth=auth, verify=certifi.where(), *_req_params)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/api.py", line 57, in request
return session.request(method=method, url=url, *_kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/sessions.py", line 475, in request
resp = self.send(prep, *_send_kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/sessions.py", line 585, in send
r = adapter.send(request, *_kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/requests/adapters.py", line 467, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.intercom.iohttps', port=443): Max retries exceeded with url: //api.intercom.io/users?per_page=50&page=2 (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x1033d75c0>: Failed to establish a new connection: [Errno 8] nodename nor servname provided, or not known',))