http connection via proxy server

Luca Calderano calderano at sgaspa.it
Fri Jun 13 06:07:24 EDT 2003


I'm trying to connect to a web page via my proxy server
using the following code

..............................
import os
import httplib

os.system("Set %http_proxy% = \\xxx.xxx.xxx.xxx:80")
myurl = "securityresponse.symantec.com/avcenter/download/pages/US-N95.html"
req=httplib.HTTP(myurl)
req.putrequest("GET","/")
req.endheaders()
................................

but it returns this traceback:

............................................................................
.................
Traceback (most recent call last):
  File
"C:\Python22\lib\site-packages\Pythonwin\pywin\framework\scriptutils.py",
line 301, in RunScript
    exec codeObject in __main__.__dict__
  File "C:\Script1.py", line 14, in ?
    req.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')
............................................................................
.................

can someone help me ???

Thanks in advance!

     Luca Calderano






More information about the Python-list mailing list