httplib throw a proxy

F. Petitjean littlejohn.75 at news.noos.fr
Mon Mar 22 08:11:48 EST 2004


On Mon, 22 Mar 2004 12:45:28 +0100, Glauco <00515879256 at fastwebnet.it> wrote:
> I'm using a library based on httplib.
> 
> Now, the problem is passing throw an http_proxy.
> It seems because httplib (based on socket.py) try to autenticate on the 
> proxy.
> 
> 
> I'm only with this problem ? it's impossible :-|
> 
> any ideas ?

use urllib2, for example :

import urllib2

def install_proxy():
    """initialize urllib2 to go through a proxy"""
    proxy_support = urllib2.ProxyHandler(
        { 'http' : "http://username:passwd@IP_proxy:8080",
          'ftp' : "http://username:passwd@IP_proxy:8080" } )
    opener = urllib2.build_opener(proxy_support)
    urllib2.install_opener(opener)

Regards



More information about the Python-list mailing list