Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

automatic proxy detect on windows #7

Closed
zhangn1985 opened this issue Jul 7, 2016 · 2 comments
Closed

automatic proxy detect on windows #7

zhangn1985 opened this issue Jul 7, 2016 · 2 comments

Comments

@zhangn1985
Copy link
Collaborator

On Linux maybe Mac, we can use os.getenv('http_proxy') to detect system proxy.

But on Windows, things different.

basically via register:

try:
    import winreg as registry
except:
    import _winreg as registry

key=registry.OpenKey(registry.HKEY_CURRENT_USER,"Software\Microsoft\Windows\CurrentVersion\Internet Settings\Connections",0,registry.KEY_ALL_ACCESS)
(value, regtype) = registry.QueryValueEx(key, "DefaultConnectionSettings")
print(value)

but value are binary format, I don't know how to parse it. help is needed.

@zhangn1985
Copy link
Collaborator Author

zhangn1985 commented Jul 7, 2016

class urllib.request.ProxyHandler(proxies=None)

Cause requests to go through a proxy. If proxies is given, it must be a dictionary mapping protocol names to URLs of proxies. The default is to read the list of proxies from the environment variables _proxy. If no proxy environment variables are set, then in a Windows environment proxy settings are obtained from the registry’s Internet Settings section, and in a Mac OS X environment proxy information is retrieved from the OS X System Configuration Framework.

@zhangn1985
Copy link
Collaborator Author

we need to add a hint to tell code, we use system proxy.

zhangn1985 pushed a commit that referenced this issue Apr 27, 2018
for #7

Signed-off-by: ykdl <zhangn1985@gmail.com>
zhangn1985 pushed a commit that referenced this issue Apr 27, 2018
for #7

Signed-off-by: ykdl <zhangn1985@gmail.com>
zhangn1985 pushed a commit that referenced this issue Apr 27, 2018
for #7

temp remove cookies

Signed-off-by: ykdl <zhangn1985@gmail.com>
zhangn1985 pushed a commit that referenced this issue Apr 27, 2018
fix #7

Signed-off-by: ykdl <zhangn1985@gmail.com>
zhangn1985 pushed a commit that referenced this issue Apr 27, 2018
for #7

Signed-off-by: ykdl <zhangn1985@gmail.com>
zhangn1985 pushed a commit that referenced this issue Apr 27, 2018
for #7

Signed-off-by: ykdl <zhangn1985@gmail.com>
zhangn1985 pushed a commit that referenced this issue Apr 27, 2018
for #7

temp remove cookies

Signed-off-by: ykdl <zhangn1985@gmail.com>
zhangn1985 pushed a commit that referenced this issue Apr 27, 2018
fix #7

Signed-off-by: ykdl <zhangn1985@gmail.com>
zhangn1985 pushed a commit that referenced this issue Apr 27, 2018
for #7

Signed-off-by: Zhang Ning <zhangn1985@gmail.com>
zhangn1985 pushed a commit that referenced this issue Apr 27, 2018
for #7

Signed-off-by: Zhang Ning <zhangn1985@gmail.com>
zhangn1985 pushed a commit that referenced this issue Apr 27, 2018
for #7

temp remove cookies

Signed-off-by: Zhang Ning <zhangn1985@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant