http connection via proxy server

Fredrik Lundh fredrik at pythonware.com
Fri Jun 13 06:15:07 EDT 2003


Luca Calderano wrote:

> 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()
> ................................

does this work better?

    import os
    import urllib

    os.environ["http_proxy"] = "http://xxx.xxx.xxx.xxx:80"
    myurl = "http://securityresponse.symantec.com/avcenter/download/pages/US-N95.html"
    page = urllib.urlopen(myurl).read()

</F>








More information about the Python-list mailing list