httplib won't accept URL with parameters (???)
pythonhda at yahoo.com.replacepythonwithlinux
Tue Jan 7 04:03:21 CET 2003
See the code changes below...
On Mon, 06 Jan 2003 23:28:09 +0100
Phillip <ritschratsch at gmx.de> wrote:
> I've got some serious httplib Problem. Here's the relevant code:
> USER_AGENT = "Navigator" # We have to give something, don't we?
> 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 ####
> CompareServer = ServerGet("www.server.com")
> ComparePage =
> # long URL, I know....
> print ComparePage
> The Problem is that CompareServer.fetch won't return anything(!!) I
> presume it has something to do with the fact that the URL that is passed
> on has a tail of parameters trailing and that httplib won't accept this.
> Does anyone know how I can get this to work? Is it a 'GET' problem?
> Note that httplib work perfect with the usual URLs that only have
> slashes in them.
> What's the big fuss? Why doesn't ServerGet return something with that
> URL? Any clue?
> Thanks for all help in advance.
More information about the Python-list