You can use the SocksiPy module. Just copy the socks.py file to the Python lib / site-packages directory and you are ready to go.
You must use socks before urllib2. (Try pip install PySocks )
For example:
import socks import socket socks.setdefaultproxy(socks.PROXY_TYPE_SOCKS5, "127.0.0.1", 8080) socket.socket = socks.socksocket import urllib2 print urllib2.urlopen('http://www.google.com').read()
You can also try pycurl lib and tsocks, for more details click here .
panweizeng Feb 26 2018-10-12T00 : 00Z
source share