'i need load proxies from a txt file in pytho proxy settings windows 10
I want a code to press the save button python can you help me https://i.stack.imgur.com/7rznQ.png]
import winreg as winreg
INTERNET_SETTINGS = winreg.OpenKey(winreg.HKEY_CURRENT_USER,
r'Software\Microsoft\Windows\CurrentVersion\Internet Settings',
0, winreg.KEY_ALL_ACCESS)
def set_key(name, value):
_, reg_type = winreg.QueryValueEx(INTERNET_SETTINGS, name)
winreg.SetValueEx(INTERNET_SETTINGS, name, 0, reg_type, value)
set_key('ProxyEnable', 1)
set_key('ProxyOverride', u'*.local;<local>') # Bypass the proxy for localhost
with open('proxies.txt','r') as fin:
proxy = fin.readline()
with open('vpn.txt', 'r') as fin:
data = fin.read().splitlines(True)
with open('vpn.txt', 'w') as fout:
fout.writelines(data[1:])
set_key('ProxyServer', u'95.164.233.251:5609')
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
