BUG URLLIB2

bart e_viola at libero.it
Thu Nov 14 19:20:47 EST 2002


I'm an italian student and my problem consists about urllib2; urlopen
function, sometimes, give me old (and inexactly) url because the site
has moved in a new location but urlopen  doesn't undestand it and return
403 error FORBIDDEN.

EXAMPLE:

Python 2.2.1 (#1, Aug 30 2002, 12:15:30)
[GCC 3.2 20020822 (Red Hat Linux Rawhide 3.2-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
   >>> import urllib2
   >>> con=urllib2.urlopen('http://www.google.it/search')
Traceback (most recent call last):
     File "<stdin>", line 1, in ?
     File "/usr/lib/python2.2/urllib2.py", line 138, in urlopen
       return _opener.open(url, data)
     File "/usr/lib/python2.2/urllib2.py", line 322, in open
       '_open', req)
     File "/usr/lib/python2.2/urllib2.py", line 301, in _call_chain
       result = func(*args)
     File "/usr/lib/python2.2/urllib2.py", line 785, in http_open
       return self.do_open(httplib.HTTP, req)
     File "/usr/lib/python2.2/urllib2.py", line 779, in do_open
       return self.parent.error('http', req, fp, code, msg, hdrs)
     File "/usr/lib/python2.2/urllib2.py", line 348, in error
       return self._call_chain(*args)
     File "/usr/lib/python2.2/urllib2.py", line 301, in _call_chain
       result = func(*args)
     File "/usr/lib/python2.2/urllib2.py", line 400, in http_error_default
       raise HTTPError(req.get_full_url(), code, msg, hdrs, fp)
urllib2.HTTPError: HTTP Error 403: Forbidden
   >>>


What can I do to repair the situation?

Help me please!!!

Thanks...

-Ennio-








More information about the Python-list mailing list