curl-and-python

who can give me a sample code,get a website page via socks5 proxy?

From: juhui <phpbird_at_gmail.com>
Date: Sun, 23 Apr 2006 23:58:05 +0800

Hi:
I want to get a page with pycurl via socks5 proxy. The code looks like below.

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

but it doesn't work..

how to use socks5 proxy in pycurl?

thanks.

--
LB can FlY
_______________________________________________
http://cool.haxx.se/cgi-bin/mailman/listinfo/curl-and-python
Received on 2006-04-23