can anyone help me about this? I just wanna set up a proxy with cmd or python. I have tried these but it doesn't work.
First try(on cmd):
netsh winhttp set proxy proxy-ip:proxy-port
Output:
C:\Windows\system32>netsh winhttp show proxy
Current WinHTTP proxy settings:
Proxy Server(s) : proxy-ip:proxy-port
Bypass List : (none)
I checked my ip on web site. Nothing changed.
Second try:
import os
import requests
os.system('netsh winhttp set proxy proxy-ip:proxy-port')
r = requests.get("https://ipinfo.io/")
print(r.text)
Stil nothing changed. What i need to do?
When you need something major changes on OS, you should provide admin permissions, here is the solution;
pip install elevate
And you can use this code;
import os
from elevate import elevate
elevate(show_console=False)
command = 'netsh winhttp set proxy proxy_ip:proxy_port bypass-list="localhost"'
os.system(command)
You can look at the details of elevate package.
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.