i'm trying to make a https post request, i'm following the example linked below.<br><br><a href="http://www.java2s.com/Tutorial/Python/0420__Network/SendinganHTTPPOSTRequestfromaPythonScript.htm">http://www.java2s.com/Tutorial/Python/0420__Network/SendinganHTTPPOSTRequestfromaPythonScript.htm</a><br>
<br>i'm trying to make the https post request to <a href="http://netflix.com">netflix.com</a>, below is my code<br><br> 1 import httplib<br> 2 <br> 3 # def statement used to parse response from web server<br> 4 def printText(txt):<br>
5 lines = txt.split('\n')<br> 6 for lines in lines:<br> 7 print line.strip()<br> 8 <br> 9 # connect to web server<br> 10 httpServ = httplib.HTTPSConnection("<a href="https://www.netflix.com">https://www.netflix.com</a>", 443)<br>
11 print httpServ<br> 12 httpServ.connect()<br> 13 <br> 14 # specifying the exact login URL<br> 15 <br> 16 request = "test"<br> 17 <br> 18 httpServ.request('POST', \<br> 19 '/Login', \<br> 20 'nextpage=http%3A%2F%<a href="http://2Fwww.netflix.com">2Fwww.netflix.com</a>%2F&SubmitButton=Click+Here+to+Continue&movieid=&trkid=&email=email%<a href="http://40gmail.com">40gmail.com</a>&password1=supersecret % request')<br>
21 <br> 22 # response<br> 23 <br> 24 response = httpServ.getresponse()<br> 25 <br> 26 print response<br> 27 if response.status == httplib.OK:<br> 28 printText (response.read())<br> 29 <br> 30 httpServ.close()<br>
<br>getting the following errors, any suggestions?<br><br>Traceback (most recent call last):<br> File "printerPythonScript.py", line 12, in <module><br> httpServ.connect()<br> File "/usr/lib/python2.5/httplib.py", line 1130, in connect<br>
sock.connect((self.host, self.port))<br> File "<string>", line 1, in connect<br>socket.gaierror: (-5, 'No address associated with hostname')<br><br>