import socket
sock = socket.socket()
sock.connect('somesite')
If I wanted the socket connect through a proxy, how would I do this? I don't see a relevant parameter or option in the docs.
import socket
sock = socket.socket()
sock.connect('somesite')
If I wanted the socket connect through a proxy, how would I do this? I don't see a relevant parameter or option in the docs.
You first need to figure out what kind of proxy it is (SOCKS, HTTP, etc), and then either find a library that implements connections for that proxy type, or roll your own routine. The basic idea is you'll have your script connect to the proxy server/port, and then request the proxy to connect to the site you're trying to request.
If you don't want to do it like that, another viable option would be to use LD_PRELOAD to get it to connect transparently (under Linux), like torify does.