sending "GET" request over proxy using httplib in python -
i trying send basic request "www.python.org" fetch "www.python.org/index.html" using httplib module in python.i use proxy server "10.1.1.19:80".my code error message shown.please suggest me mistakes i'm commiting.regards....
>>> import httplib >>> conn=httplib.httpconnection("http://www.python.org",80) >>> conn.set_tunnel("10.1.1.19:80") >>> conn.request("get","www.python.org/index.html",headers={"proxy-authorization":"basic "+"mzewntmzomdvewfs"}) traceback (most recent call last): file "<pyshell#3>", line 1, in <module> conn.request("get","www.python.org/index.html",headers={"proxy-authorization":"basic "+"mzewntmzomdvewfs"}) file "c:\python27\lib\httplib.py", line 973, in request self._send_request(method, url, body, headers) file "c:\python27\lib\httplib.py", line 1007, in _send_request self.endheaders(body) file "c:\python27\lib\httplib.py", line 969, in endheaders self._send_output(message_body) file "c:\python27\lib\httplib.py", line 829, in _send_output self.send(msg) file "c:\python27\lib\httplib.py", line 791, in send self.connect() file "c:\python27\lib\httplib.py", line 772, in connect self.timeout, self.source_address) file "c:\python27\lib\socket.py", line 553, in create_connection res in getaddrinfo(host, port, 0, sock_stream): gaierror: [errno 11004] getaddrinfo failed`
try this
import httplib conn = httplib.httpconnection("10.1.1.19", 80) conn.request("get", "http://www.python.org/index.html", headers={...}))
Comments
Post a Comment