urllib2 and HTTP 302
John J. Lee
jjl at pobox.com
Fri Jun 2 00:08:25 CEST 2006
Laszlo Nagy <gandalf at designaproduct.biz> writes:
> how can I return the redirection URL?
> I tried to get this information from the exception but I could not. Is
> it possible to read it from the openerdirector?
> Any suggestions?
> except urllib2.HTTPError, e:
> if e.code == 302:
> return "I would like to get the URL to be redirected
redirected_url = e.geturl()
More information about the Python-list