This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: addheaders for urlopen / open / xxxx_open
Type: enhancement Stage: test needed
Components: Library (Lib) Versions: Python 3.4
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: kxroberto, orsenthil
Priority: normal Keywords:

Created on 2006-03-19 18:55 by kxroberto, last changed 2022-04-11 14:56 by admin.

Messages (2)
msg61227 - (view) Author: kxroberto (kxroberto) Date: 2006-03-19 18:55
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
msg61228 - (view) Author: Josiah Carlson (josiahcarlson) * (Python triager) Date: 2006-03-29 20:27
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.
History
Date User Action Args
2022-04-11 14:56:16adminsetgithub: 43055
2019-05-02 04:31:14josiahcarlsonsetnosy: - josiahcarlson
2013-03-13 21:22:16ezio.melottisetversions: + Python 3.4, - Python 3.2
2010-08-09 03:18:23terry.reedysetversions: + Python 3.2, - Python 3.1, Python 2.7
2009-02-12 17:56:14ajaksu2setnosy: + orsenthil
stage: test needed
versions: + Python 3.1, Python 2.7
2006-03-19 18:55:38kxrobertocreate