httplib won't accept URL with parameters (???)
Phillip
ritschratsch at gmx.de
Mon Jan 6 17:28:09 EST 2003
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", "*/*")
http.endheaders()
# get response
errcode, errmsg, headers = http.getreply()
file = http.getfile()
return file.read()
CompareServer = ServerGet("www.server.com")
ComparePage =
CompareServer.fetch("/grab/database/get-page/link=ddb_benutzt_a/00b-97rt692-8ab6561?view=fixed-thing&field-stuff-type=used&thing-number=3897211920&field-status=open&size=25&rank=+parameter")
# 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.
Phillip
More information about the Python-list
mailing list