Fundamental problem with urllib...

Jonathan Hseu vomjom at vomjom.org
Sat Apr 20 04:02:45 EDT 2002


Urllib will always have problems with some sites.  Notably, sites with
cookies that also redirect.

Here's what happens:
Say, perhaps after POSTing, you want to grab a cookie from the headers.
The website puts the cookie in a 302 message (redirection for those of
you who don't know HTTP responses), and then redirects you elsewhere.
Now, to grab the cookie, you need to be able to get the headers of that
message before getting redirected.

This is certainly not possible without overriding some functions in
FancyURLopener or declaring some in URLopener (which creates exceptions
for all HTTP responses != 200).  This isn't a big deal (I did it myself
for my program), but this can be simply fixed by adding support for
cookies within urllib.

Shall I take it upon myself to make such a patch?  Comments/Flames?

I personally think easy cookie handling within urllib is a good thing.
-- 
Jonathan Hseu <vomjom at vomjom.org, vomjom at debian.org, jh4 at cec.wustl.edu>
GPG ID:          5228D713
GPG fingerprint: 220B A4EF 70FE B884 CB38  F93F EA8A 1024 5228 D713





More information about the Python-list mailing list