Help with gaierror: (7, 'getaddrinfo failed')
Whit Whitfield
whit at shaftnet.org
Mon Feb 10 11:04:16 EST 2003
I'm tinkering around with get and post and whatnot and can't seem to
get this script to post to one simple form. I'm sure I goofed
somewhere if you could take a look:
Error message:
Traceback (most recent call last):
File "C:\Python22\Lib\site-packages\testing2.py", line 9, in ?
conn.request("POST", "mail.php", params, headers)
File "C:\Python22\lib\httplib.py", line 701, in request
self._send_request(method, url, body, headers)
File "C:\Python22\lib\httplib.py", line 723, in _send_request
self.endheaders()
File "C:\Python22\lib\httplib.py", line 695, in endheaders
self._send_output()
File "C:\Python22\lib\httplib.py", line 581, in _send_output
self.send(msg)
File "C:\Python22\lib\httplib.py", line 548, in send
self.connect()
File "C:\Python22\lib\httplib.py", line 516, in connect
socket.SOCK_STREAM):
gaierror: (7, 'getaddrinfo failed')
Code:
import httplib, urllib
fields = { "name": "tester", "email": "xx at xx.org", "color": "blue" ,
"comment": "none" }
params = urllib.urlencode(fields)
headers = {"Content-type": "application/x-www-form-urlencoded",
"Accept": "text/plain"}
conn = httplib.HTTPConnection("www.gpc.edu/~whitfie3:80")
conn.request("POST", "mail.php", params, headers)
response = conn.getresponse()
print response.status, response.reason
data = response.read()
conn.close()
-- mail.php simply takes the form data and mails it to your own
address that
you entered.
Thanks for any help!
Whit Whitfield
More information about the Python-list
mailing list