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

Too Many Requests: Max retries exceeded with url #31

Open
rariehle opened this issue Mar 2, 2017 · 7 comments
Open

Too Many Requests: Max retries exceeded with url #31

rariehle opened this issue Mar 2, 2017 · 7 comments

Comments

@rariehle
Copy link

rariehle commented Mar 2, 2017

When I attempt to create a Bulk object I get a Max retries error. The same authentication is working if I go directly to the Eloqua website. The site takes a few seconds to load in my work environment. I am wondering if I am having troubles with a proxy. Is there a sleep method or a way to tweak the retry interval?

conn = Bulk(company = 'my company', username = 'me', password = 'my password')
yields...

:
ConnectionError: HTTPSConnectionPool(host='login.eloqua.com', port=443): Max retries exceeded with url: /id (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000000005749400>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',))

@colemanja91
Copy link
Owner

Looking at similar issues with the requests package, probably need to be able to pass the timeout parameter to those functions (http://docs.python-requests.org/en/master/user/advanced/#timeouts). Actually, might be good to be able to pass any kwargs down to that level (i.e., proxies, certs).

I'll dig into this a bit tonight or tomorrow. Maybe allow passing/setting a dict of arguments to pass, ala: https://docs.python.org/3/tutorial/controlflow.html#unpacking-argument-lists

@rariehle
Copy link
Author

rariehle commented Mar 3, 2017 via email

@colemanja91
Copy link
Owner

@rariehle since I can't recreate locally, can you install the branch here:
https://github.com/colemanja91/pyeloqua/tree/feature/requestskwargs

and try this:
conn = Bulk(company = 'my company', username = 'me', password = 'my password', timeout=20)

maybe play around with the timeout variable to see if that helps?

@colemanja91
Copy link
Owner

@rariehle have you had a chance to test yet?

@rariehle
Copy link
Author

Yes. Thank you very much for following up on this.

I received a similar response. Tweaking with the timeout made the lag longer but not much change occurred.

I am going to give you the whole error output this time:

from pyeloqua import pyeloqua
print(pyeloqua.API_VERSION)
2.0

conn = Bulk(company = 'xxx', username = 'xxx', password = 'xxx', timeout = 20)


ConnectionRefusedError Traceback (most recent call last)
C:\Program Files\Anaconda3\lib\site-packages\requests\packages\urllib3\connection.py in _new_conn(self)
141 conn = connection.create_connection(
--> 142 (self.host, self.port), self.timeout, **extra_kw)
143

C:\Program Files\Anaconda3\lib\site-packages\requests\packages\urllib3\util\connection.py in create_connection(address, timeout, source_address, socket_options)
90 if err is not None:
---> 91 raise err
92

C:\Program Files\Anaconda3\lib\site-packages\requests\packages\urllib3\util\connection.py in create_connection(address, timeout, source_address, socket_options)
80 sock.bind(source_address)
---> 81 sock.connect(sa)
82 return sock

ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

During handling of the above exception, another exception occurred:

NewConnectionError Traceback (most recent call last)
C:\Program Files\Anaconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, **response_kw)
577 body=body, headers=headers,
--> 578 chunked=chunked)
579

C:\Program Files\Anaconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py in _make_request(self, conn, method, url, timeout, chunked, **httplib_request_kw)
350 try:
--> 351 self._validate_conn(conn)
352 except (SocketTimeout, BaseSSLError) as e:

C:\Program Files\Anaconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py in _validate_conn(self, conn)
813 if not getattr(conn, 'sock', None): # AppEngine might not have .sock
--> 814 conn.connect()
815

C:\Program Files\Anaconda3\lib\site-packages\requests\packages\urllib3\connection.py in connect(self)
253 # Add certificate verification
--> 254 conn = self._new_conn()
255

C:\Program Files\Anaconda3\lib\site-packages\requests\packages\urllib3\connection.py in _new_conn(self)
150 raise NewConnectionError(
--> 151 self, "Failed to establish a new connection: %s" % e)
152

NewConnectionError: <requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000000005BD6908>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it

During handling of the above exception, another exception occurred:

MaxRetryError Traceback (most recent call last)
C:\Program Files\Anaconda3\lib\site-packages\requests\adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
402 retries=self.max_retries,
--> 403 timeout=timeout
404 )

C:\Program Files\Anaconda3\lib\site-packages\requests\packages\urllib3\connectionpool.py in urlopen(self, method, url, body, headers, retries, redirect, assert_same_host, timeout, pool_timeout, release_conn, chunked, **response_kw)
622 retries = retries.increment(method, url, error=e, _pool=self,
--> 623 _stacktrace=sys.exc_info()[2])
624 retries.sleep()

C:\Program Files\Anaconda3\lib\site-packages\requests\packages\urllib3\util\retry.py in increment(self, method, url, response, error, _pool, _stacktrace)
280 if new_retry.is_exhausted():
--> 281 raise MaxRetryError(_pool, url, error or ResponseError(cause))
282

MaxRetryError: HTTPSConnectionPool(host='login.eloqua.com', port=443): Max retries exceeded with url: /id (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000000005BD6908>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',))

During handling of the above exception, another exception occurred:

ConnectionError Traceback (most recent call last)
in ()
----> 1 conn = Bulk(company = 'xxx', username = 'xxxxxxxxxx', password = 'xxxxxxxx', timeout = 100)

C:\Program Files\Anaconda3\lib\site-packages\pyeloqua-0.4.3-py3.5.egg\pyeloqua\bulk.py in init(self, username, password, company, test, **kwargs)
56 :return: Bulk object
57 """
---> 58 Eloqua.init(self, username, password, company, test, **kwargs)
59 self.job = deepcopy(BLANK_JOB)
60 self.job_def = {}

C:\Program Files\Anaconda3\lib\site-packages\pyeloqua-0.4.3-py3.5.egg\pyeloqua\pyeloqua.py in init(self, username, password, company, test, **kwargs)
42 url = 'https://login.eloqua.com/id'
43 req = requests.get(url, auth=(company + '\' + username,
---> 44 password), **kwargs)
45
46 # check if any error codes

C:\Program Files\Anaconda3\lib\site-packages\requests\api.py in get(url, params, **kwargs)
69
70 kwargs.setdefault('allow_redirects', True)
---> 71 return request('get', url, params=params, **kwargs)
72
73

C:\Program Files\Anaconda3\lib\site-packages\requests\api.py in request(method, url, **kwargs)
55 # cases, and look like a memory leak in others.
56 with sessions.Session() as session:
---> 57 return session.request(method=method, url=url, **kwargs)
58
59

C:\Program Files\Anaconda3\lib\site-packages\requests\sessions.py in request(self, method, url, params, data, headers, cookies, files, auth, timeout, allow_redirects, proxies, hooks, stream, verify, cert, json)
473 }
474 send_kwargs.update(settings)
--> 475 resp = self.send(prep, **send_kwargs)
476
477 return resp

C:\Program Files\Anaconda3\lib\site-packages\requests\sessions.py in send(self, request, **kwargs)
583
584 # Send the request
--> 585 r = adapter.send(request, **kwargs)
586
587 # Total elapsed time of the request (approximately)

C:\Program Files\Anaconda3\lib\site-packages\requests\adapters.py in send(self, request, stream, timeout, verify, cert, proxies)
465 raise ProxyError(e, request=request)
466
--> 467 raise ConnectionError(e, request=request)
468
469 except ClosedPoolError as e:

ConnectionError: HTTPSConnectionPool(host='login.eloqua.com', port=443): Max retries exceeded with url: /id (Caused by NewConnectionError('<requests.packages.urllib3.connection.VerifiedHTTPSConnection object at 0x0000000005BD6908>: Failed to establish a new connection: [WinError 10061] No connection could be made because the target machine actively refused it',))

@inarvekar
Copy link

inarvekar commented Jan 23, 2019

ConnectionError: HTTPSConnectionPool(host='qa-api-proxy-gcp-insights-api.XXX.com', port=443): Max retries exceeded with url: //insights/audience-insights/dsSegmentType?type=1&groupId=19&dsId=331 (Caused by ProtocolError('Connection aborted.', error("(104, 'ECONNRESET')",)))

@MuqadderIqbal
Copy link

MuqadderIqbal commented Aug 7, 2019

I've spent considerable time (successfully) developing a similar Eloqua BULK extractor utility and I've come across this error occasionally. @inarvekar @rariehle do you happen to be behind a corporate firewall/proxy? If yes, you'll need to add proxy and proxyauth parameters to the http request(s) to access the Eloqua APIs. Perhaps @colemanja91 can add this as an optional config parameter in the init.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants