mirror of
https://github.com/python/cpython.git
synced 2025-08-31 05:58:33 +00:00
#5624: _winreg is winreg in Python 3.
This commit is contained in:
parent
99412e559b
commit
4ed72acd68
4 changed files with 16 additions and 14 deletions
|
@ -2160,18 +2160,18 @@ elif os.name == 'nt':
|
|||
"""
|
||||
proxies = {}
|
||||
try:
|
||||
import _winreg
|
||||
import winreg
|
||||
except ImportError:
|
||||
# Std module, so should be around - but you never know!
|
||||
return proxies
|
||||
try:
|
||||
internetSettings = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER,
|
||||
internetSettings = winreg.OpenKey(winreg.HKEY_CURRENT_USER,
|
||||
r'Software\Microsoft\Windows\CurrentVersion\Internet Settings')
|
||||
proxyEnable = _winreg.QueryValueEx(internetSettings,
|
||||
proxyEnable = winreg.QueryValueEx(internetSettings,
|
||||
'ProxyEnable')[0]
|
||||
if proxyEnable:
|
||||
# Returned as Unicode but problems if not converted to ASCII
|
||||
proxyServer = str(_winreg.QueryValueEx(internetSettings,
|
||||
proxyServer = str(winreg.QueryValueEx(internetSettings,
|
||||
'ProxyServer')[0])
|
||||
if '=' in proxyServer:
|
||||
# Per-protocol settings
|
||||
|
@ -2208,17 +2208,17 @@ elif os.name == 'nt':
|
|||
|
||||
def proxy_bypass_registry(host):
|
||||
try:
|
||||
import _winreg
|
||||
import winreg
|
||||
import re
|
||||
except ImportError:
|
||||
# Std modules, so should be around - but you never know!
|
||||
return 0
|
||||
try:
|
||||
internetSettings = _winreg.OpenKey(_winreg.HKEY_CURRENT_USER,
|
||||
internetSettings = winreg.OpenKey(winreg.HKEY_CURRENT_USER,
|
||||
r'Software\Microsoft\Windows\CurrentVersion\Internet Settings')
|
||||
proxyEnable = _winreg.QueryValueEx(internetSettings,
|
||||
proxyEnable = winreg.QueryValueEx(internetSettings,
|
||||
'ProxyEnable')[0]
|
||||
proxyOverride = str(_winreg.QueryValueEx(internetSettings,
|
||||
proxyOverride = str(winreg.QueryValueEx(internetSettings,
|
||||
'ProxyOverride')[0])
|
||||
# ^^^^ Returned as Unicode but problems if not converted to ASCII
|
||||
except WindowsError:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue