Doesn't work (was: Re: httplib won't accept URL with parameters (???))
ritschratsch at gmx.de
Wed Jan 8 13:18:10 CET 2003
> I'm using python 2.2.1
> This works for me...I get the source of the page:
> import httplib
> USER_AGENT = "Navigator"
> class ServerGet:
> def __init__(self, host):
> self.host = host
> def fetch(self, path):
> http = httplib.HTTP(self.host)
> # write header
> http.putrequest("GET", path)
> http.putheader("User-Agent", USER_AGENT)
> http.putheader("Host", self.host)
> http.putheader("Accept", "*/*")
> # get response
> errcode, errmsg, headers = http.getreply()
> file = http.getfile()
> data = file.read()
> return data
> Maybe our versions conflict? Check section 11.6.2 in the library
> reference. It is a little different from your version. I believe you're
> using an antiquated class "HTTP". The doc string for *me* says:
> 'Compatibility class with httplib.py from 1.5.'. So not being microsoft, I
> won't say "Upgrade!" :) - We're probably not speaking the same version...
I'm supecting the same since last evening. From how I interpret you I just
need to upgrade and the same class should run, yes? Or is there something
else to do with that new httpConnect class?
Anyway, I'll get the latest Python and tell you how it turned out. Thanks
for the help!
More information about the Python-list