[Patches] [ python-Patches-1673007 ] urllib2 requests history + HEAD support

SourceForge.net noreply at sourceforge.net
Fri Apr 20 23:45:07 CEST 2007


Patches item #1673007, was opened at 2007-03-03 09:01
Message generated for change (Comment added) made by jorend
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=1673007&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Library (Lib)
Group: Python 2.6
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: KDanilov aka koder (koder_ua)
Assigned to: Nobody/Anonymous (nobody)
Summary: urllib2 requests history + HEAD support

Initial Comment:
1)Add history off all sent and received headers/requests 
to addinfourl object. Save redirections history too.

>>> fd = urllib2.urlopen("http://www.python.org/")
>>> print fd.history[0].request_line
GET / HTTP/1.1
>>> print fd.history[0].sended
[('Accept-Encoding', 'identity'), ('Host', 'www.python.org'), ('Connection', 'cl
ose'), ('User-Agent', 'Python-urllib/2.6')]

2)Add support for HEAD (and other) requests:

>>> fd = urllib2.urlopen("http://www.python.org/",
                         request_cmd = "HEAD")
>>> print len(fd.read())
0

Please send email here:
koder_dot_mail_at_gmail_dot_com

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

Comment By: Jason Orendorff (jorend)
Date: 2007-04-20 17:45

Message:
Logged In: YES 
user_id=18139
Originator: NO

koder_ua, what's the history useful for?  I'm not against it... exactly...
it just seems like I would never use it.  If I did want a history of HTTP
activity, I would need to maintain it myself.  I wouldn't want it tied to a
particular object--these urlopen() objects, typically you open them, read
them, and then throw them away.

I'm iffy on the API for 2) as well, but I can see the appeal.

The thing is... this patch is really, really rough.  In one of the tests,
an attribute is called "sended_hdrs" in one place and "sended_headers" in
another.  (Actually it should be called "request_headers".  Likewise
"recived" and "res" should each be spelled "response".)  The whitespace
isn't PEP 8.  It's also missing a doc patch.



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

Comment By: KDanilov aka koder (koder_ua)
Date: 2007-03-07 04:41

Message:
Logged In: YES 
user_id=1620221
Originator: YES

Make diff file with svn and delete previos
File Added: http_history_and_rtype_svn.diff

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

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


More information about the Patches mailing list