Feature Requests item #1453973, was opened at 2006-03-19 10:55 Message generated for change (Comment added) made by josiahcarlson 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 ---------------------------------------------------------------------- Comment By: Josiah Carlson (josiahcarlson) Date: 2006-03-29 12:27 Message: Logged In: YES user_id=341410 Whether or not urllib2 imports generally unneeded modules is a different matter than whether inserting headers should be easier. In the future, please separate feature requests from random chatter about a module. I'm personally for making it easier to include alternate headers, though am ambiguous as to your suggested change. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1453973&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com