how to change system-wide proxy settings by Python ?

Michael Torrie torriem at gmail.com
Sun Feb 3 13:06:21 EST 2013


On 02/03/2013 08:34 AM, iMath wrote:
> I have already known a valid proxy server(63.141.216.159)and
> port(8087) which support both http and https protocols ,so how to
> change system-wide proxy settings to this proxy by Python ? I use
> WinXP ,can you show  me an example of this ? thanks in advance !

There really is no way on any operating system to set a system-wide
proxy that is honored by every program that does http.

However if you can change the one "Internet Settings" proxy
programmatically, any windows app that use the IE browser engine will
pick it up.  One method to do this is to interact with the registry.
You can google for the appropriate key.  Setting it for all users,
though, is a bit trickier.  Your script would need privileges to access
keys in HKEY_LOCAL_MACHINE.

But be warned that other programs like firefox and Chrome will not
automatically know about this setting or honor it.  Or any program that
implements its own http requests with sockets.  It's not something that
can be enforced as a sort of policy.  If you need that kind of
enforcing, you'll have to work with the network hardware to block
un-proxied http and https traffic.



More information about the Python-list mailing list