[Tutor] Fwd: urllib2.urlopen(url)
Kent Johnson
kent37 at tds.net
Fri Apr 18 17:33:31 CEST 2008
On Fri, Apr 18, 2008 at 8:19 AM, Monika Jisswel <monjissvel at googlemail.com>
wrote:
> Hi,
>
> can i stop urllib2.urlopen() from following redirects automatically ?
There doesn't seem to be an easy way to do this. Probably the simplest way
is to create a subclass of HTTPRedirectHandler that does nothing and build
an opener that uses that.
>
>
> one more question i had in mind, the function urllib2.urlopen.geturl()
> does get me what i want but does it do the download of the page i was
> redirected to ? or just downloads the initial page that actually does the
> redirect ?
>
It gets the page you were redirected to.
If you want access to the redirect code, see the note about Universal Feed
Parser here:
http://personalpages.tds.net/~kent37/kk/00010.html#e10other-resources<http://personalpages.tds.net/%7Ekent37/kk/00010.html#e10other-resources>
Kent
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20080418/01f022c9/attachment.htm
More information about the Tutor
mailing list