How to set proxy in Windows with Python?

12,233

urllib module automatically retrieves settings from registry when no proxies are specified as a parameter or in the environment variables

In a Windows environment, if no proxy environment variables are set, proxy settings are obtained from the registry’s Internet Settings section.

See the documentation of urllib module referenced in the earlier post.

To set the proxy I assume you'll need to use the pywin32 module and modify the registry directly.

Share:
12,233

Related videos on Youtube

Esteban Küber
Author by

Esteban Küber

My name is Esteban Kuber. I'm a Software Simian. http://25.media.tumblr.com/tumblr_m7nsbuY93c1rzupqxo1_400.jpg

Updated on May 25, 2022

Comments

  • Esteban Küber
    Esteban Küber almost 2 years

    How can I get the current Windows' browser proxy setting, as well as set them to a value?

    I know I can do this by looking in the registry at Software\Microsoft\Windows\CurrentVersion\Internet Settings\ProxyServer, but I'm looking, if it is possible, to do this without messing directly with the registry.

  • Esteban Küber
    Esteban Küber almost 15 years
    I also need to set the proxy system wide (for Internet Explorer and other Microsoft software), not just my application. Anyway, thanks for the pointer.