how to use socks5 proxy in pycurl?

Ju Hui phpbird at gmail.com
Tue Apr 18 03:21:11 EDT 2006


import pycurl
c = pycurl.Curl()
c.setopt( pycurl.URL, 'http://www.test.com/test.html' )
import StringIO
b = StringIO.StringIO()
c.setopt( c.WRITEFUNCTION, b.write )
c.setopt( c.FOLLOWLOCATION, 1 )
c.setopt( c.MAXREDIRS, 5 )
c.setopt(c.PROXY,'www.test.com:1080')
#c.setopt(c.PROXYTYPE,'SOCKS5')
c.setopt(c.PROXYUSERPWD, 'user:pass')
c.perform()
print b.getvalue()


how to use socks5 proxy in pycurl?




More information about the Python-list mailing list