简体   繁体   中英

Socket with Proxy in Python 3.4

I have a code that I want to pass all packages through the proxy, how can I do it using:

import socket
import #Here your socket library
# The rest of the code here

Which library do you recommend me to use with Socket? Is it really possible what I'm saying?

Using Socksipy in Python 3.4 I can let the code with 3 more lines that are:

 import socksipy
 s=socket.socket( )
 s = socks.socksocket()
 s.setproxy(socks.PROXY_TYPE_SOCKS5, 'localhost', 9050)
 s.connect((HOST, PORT))

Socksipy can be found at: http://socksipy.sourceforge.net/ and its very simple to use, you just need to read their wiki so than you can work with. The URL for the wiki is: https://code.google.com/p/socksipy-branch/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM