I'm using python 3.2.2. If I try to do:
urllib.request.urlopen('https://pypi.python.org/simple/babel')
I get following error message:
Traceback (most recent call last):
File "solver.py", line 93, in <module>
generateMetadata('babel')
File "solver.py", line 76, in generateMetadata
linklist = parseURL(name)
File "solver.py", line 20, in parseURL
resp = opener.open(REP_URL+name+'/')
File "/usr/lib/python3.2/urllib/request.py", line 375, in open
response = meth(req, response)
File "/usr/lib/python3.2/urllib/request.py", line 487, in http_response
'http', request, response, code, msg, hdrs)
File "/usr/lib/python3.2/urllib/request.py", line 407, in error
result = self._call_chain(*args)
File "/usr/lib/python3.2/urllib/request.py", line 347, in _call_chain
result = func(*args)
File "/usr/lib/python3.2/urllib/request.py", line 560, in http_error_302
headers, fp)
urllib.error.HTTPError: HTTP Error 301: Moved Permanently - Redirection to url '/simple/Babel' is not allowed
After searching I found that it should handle redirects automatically.
if urlparts.scheme not in ('http', 'https', 'ftp', ''):. Your URL must be dodgy, check that it uses the correct scheme.repr(url)to make sure you catch any special characters.