[ python-Feature Requests-841728 ] urllib and cookie module improvements

SourceForge.net noreply at sourceforge.net
Thu Nov 13 15:56:28 EST 2003


Feature Requests item #841728, was opened at 2003-11-13 20:56
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=841728&group_id=5470

Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: paul rubin (phr)
Assigned to: Nobody/Anonymous (nobody)
Summary: urllib and cookie module improvements

Initial Comment:
1. The Cookie module should do a better job parsing real-
world cookies (the stuff that comes from http servers 
following Set-cookie: headers) and should also have a 
documented way to emit a client-side cookie (i.e. 
generate a correct Cookie: header from a cookie 
object).  

2. Urllib or urllib2 should be enhanced to read incoming 
cookie headers and send back the appropriate cookies in 
the event of an HTTP redirect.  Many sites set a cookie 
then redirect to some other location which tries to read 
the cookie; if the cookie isn't there, the new location 
bounces back to the original one to set the cookie, so 
you get a redirection loop.

3. The scheme of having urllib.urlopen() return the http 
headers in a dictionary-like object doesn't quite work: 
for example, there can be several Set-cookie headers in 
a single http response.  I don't know if the opener 
currently combines them or discards some; neither way 
is really satisfactory.  There really should be a list for 
each header type, but that would mess up the existing 
published interface, so maybe a new 'urllib3' is needed.  
I'm just starting to explore this stuff but it seems to me 
like a serious urllib module needs to do quite a bit more 
than the existing ones do.  The Perl LWP documentation 
might be a good place to look for inspiration.

----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=841728&group_id=5470



More information about the Python-bugs-list mailing list