urllib3 maxretryError
Asked Answered
P

1

12

I have just started using urllib3, and I am running into a problem straightaway. According to their manuals, I started off with the simple example:

Python 2.7.1+ (r271:86832, Apr 11 2011, 18:13:53) 
[GCC 4.5.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib3
>>> 
>>> http = urllib3.PoolManager()
>>> r = http.request('GET', 'http://google.com/')

I get thrown the following error:

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/urllib3/request.py", line 65, in request
**urlopen_kw)
File "/usr/local/lib/python2.7/dist-packages/urllib3/request.py", line 78, in request_encode_url
return self.urlopen(method, url, **urlopen_kw)
File "/usr/local/lib/python2.7/dist-packages/urllib3/poolmanager.py", line 113, in urlopen
return self.urlopen(method, e.new_url, **kw)
File "/usr/local/lib/python2.7/dist-packages/urllib3/poolmanager.py", line 113, in urlopen
return self.urlopen(method, e.new_url, **kw)
File "/usr/local/lib/python2.7/dist-packages/urllib3/poolmanager.py", line 113, in urlopen
return self.urlopen(method, e.new_url, **kw)
File "/usr/local/lib/python2.7/dist-packages/urllib3/poolmanager.py", line 113, in urlopen
return self.urlopen(method, e.new_url, **kw)
File "/usr/local/lib/python2.7/dist-packages/urllib3/poolmanager.py", line 109, in urlopen
return conn.urlopen(method, url, **kw)
File "/usr/local/lib/python2.7/dist-packages/urllib3/connectionpool.py", line 309, in urlopen
raise MaxRetryError(url)
urllib3.exceptions.MaxRetryError: Max retries exceeded for url: http://google.com/

Any clues as to why this happens? Many thanks.

Psychochemical answered 26/1, 2012 at 16:8 Comment(0)
P
11

This is a known bug which has been fixed in the master branch:

I really should have published a bugfix release last weekend with this fix, but I ran out of time. The next release this coming weekend should include this fix (and a bunch of other cool improvements). Sorry for the troubles!

Update: urllib3 v1.2 is now on PyPI which includes this fix and more. :)

Phillips answered 26/1, 2012 at 16:26 Comment(2)
thanks a lot for your reply. Thought I was doing something stupid. Also, does this bug affect your "Mass Downloader"? I am going to try and use MD today, and was wondering which files do I need to download from github? Do I just place the workerpool directory into my python path?Psychochemical
@Psychochemical Good news, v1.2 is in PyPI, so you should be able to just install urllib3 as normal and get the fixed version.If you want to install from Github master, I something like pip install git+https://github.com/shazow/urllib3 should work.Phillips

© 2022 - 2024 — McMap. All rights reserved.