[ python-Feature Requests-1453973 ] addheaders for urlopen / open / xxxx_open

SourceForge.net noreply at sourceforge.net
Sun Mar 19 19:55:38 CET 2006


Feature Requests item #1453973, was opened at 2006-03-19 19:55
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=1453973&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: Python Library
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: kxroberto (kxroberto)
Assigned to: Nobody/Anonymous (nobody)
Summary: addheaders for urlopen / open / xxxx_open

Initial Comment:
Adding a header also for each open call is a frequent
need for me (much more than e.g. proxies per call in
urllib1/urlopen). 

For example:

urlopen(url,data,addheaders=[('Referer':lasturl)])

So far one is forced to set the _complete_ re-rendered
bunch of opener.addheaders each time (and to maintain a
separate opener for each thread )

open/OpenerDirector.open maybe should distribute
*args,**kwargs

---

Note on disciplined use of protocol modules in urllib2
( see also #1046077 ):

urllib2 still draws in all kind of (future?) protocol
modules all in advance =>  slows down app startup / cgi
script's ...; ugly non-pythonic/non-modular; unused
prots cannot be excluded for cx_Freeze,setup ... 
Now the fat cookielib was also added in that manner.
Thus, when you use urllib2 for "ftp://xy", you load
also all kind of fun (down to things like
_MozillaCookieJar) into Python. 

The need for those imports is very local (search e.g.
"ftplib."). ==> local import in those few places.

I saw, this jam style already encouraged more
undisciplined dependencies like :
"origin_req_host = cookielib.request_host(self)"
(~urllib2-py2.4/line 191) in the general Request.__init__ 


Robert

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

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


More information about the Python-bugs-list mailing list