httplib\urllib attributes problem
Bobbie
lorenb2 at bezeqint.net
Sun Jul 20 17:57:48 EDT 2003
I'm really doing my first python steps here...
can you show me where and how should the "opener.addheaders = []" code
be added to a simple web-client like the following:
import urllib2
url = 'http://www.google.com'
body = None
headers = {"User-Agent" : "My first python browser",
"Accept-Language" : "en-us",
"Accept-Encoding" : "deflate",
"Connection" : "Close"}
connectobj = urllib2.Request(url,body,headers)
webfile = urllib2.urlopen(connectobj)
thanks
B.
----- Original Message -----
From: "Jordan Krushen" <jordan at krushen.com>
To: "Bobbie" <lorenb2 at bezeqint.net>
Cc: <python-list at python.org>
Sent: Monday, July 21, 2003 10:43 AM
Subject: Re: httplib\urllib attributes problem
> On Sun, 20 Jul 2003 23:36:44 +0200, Bobbie <lorenb2 at bezeqint.net> wrote:
>
> > hmmm.
> > But doesn't that apply to the suggested "opener.addheaders = []" change
> > as
> > well ?
>
> That would go in your code, not in urllib2.py. You have control over when
> your code changes, and if you ship a package to other users, this would
> still be able to override their libraries, too.
>
> J.
>
>
>
More information about the Python-list
mailing list