newhttplib, creates automatic headers?
Tuca Atuc
atuc at gmx.de
Wed Jan 2 04:06:51 EST 2002
hallo,
i changed to the new python httplib and looked with a packet analyser and
wondering why the new lib always sets this 2 headers automatically?
Host: www.google.com
Accept-Encoding: identity
i would like to set all headers by hand and tryed it with:
c = httplib.HTTPConnection( server, 80 )
#### den Request (z.b. IE5 Simulation)
c.putrequest('GET', path)
c.putheader('Accept', 'image/gif, image/x-xbitmap, image/jpeg,
image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel,
application/msword, */*')
c.putheader('Accept-Language', 'de')
c.putheader('User-Agent', 'Mozilla/4.0 (compatible; MSIE 5.5;
Windows NT 5.0')
#c.putheader('Host', server)
c.putheader('Connection', 'Keep-Alive')
c.endheaders()
r = c.getresponse()
print r.status, r.reason
data = r.read()
is it possible to avoid automatic appending of this 2 headers in the new
httplib?
thanks,
alex
More information about the Python-list
mailing list