Why won't this POST
brueckd at tbye.com
brueckd at tbye.com
Tue Apr 23 10:12:38 EDT 2002
On 22 Apr 2002, Sunit Joshi wrote:
> Hello
> I'm trying to post data to IIS5.0 but keep getting error message about
> "host not found". The python script is in /cgi-bin/ProcessInput.py. I
> socket.error: host not found
[snip]
> req = HTTP('localhost/eubix')
> req.putrequest('POST' ,'/cgi-bin/ProcessInput.py') #Here's where it
> stalls
'localhost/eubix' isn't a valid hostname, hence the error. When you
construct the HTTP object you must pass in just the host name or IP
address (and port if you need to override the default):
req = HTTP('localhost')
Then in putrequest you need to specify the URL to get to the object on the
server that you're interested in. I'm not sure how you have things set up,
but I'm guessing it'll be either
req.putrequest('POST', '/cgi-bin/ProcessInput.py') # Like you have it
or
req.putrequest('POST', '/eubix/cgi-bin/ProcessInput.py')
Also note that this whole thing might be easier if you use urllib instead.
-Dave
More information about the Python-list
mailing list