基本上我想做的是在我能够浏览互联网的同时能够连接到代理
这是我试过的代码
import webbrowser
import socks, socket, requests
from multiprocessing import Process
def proxy():
while True:
socks.set_default_proxy(socks.SOCKS5, "184.32.91.92", 2901)
socket.socket = socks.socksocket
if __name__ == '__main__':
proxy_process = Process(target=proxy).start()
r = requests.get("http://icanhazip.com")
print(r.content) # stil gives me my actual IP address
webbrowser.open("http://icanhazip.com", new=2) # opening the webbrowser
所以我尝试处理代理以保持连接有效但即使我打开浏览器它仍然给我我的实际 IP
杨__羊羊
相关分类