Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6058477
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T08:36:13+00:00 2026-05-23T08:36:13+00:00

I have written a program that relies on a proxy to function. I now

  • 0

I have written a program that relies on a proxy to function. I now need a script that will check to see if the browser is set to use the right proxy, and if not, change it to use it. I need this implemented for as many browsers as possible, but is only required for Internet Explorer, Google Chrome, Mozilla Firefox, Safari and Opera. I am not even sure how to go about this, but it is for a project for work that will be due in a few days. If anyone can help or lend advice, I would greatly appreciate it!

I am programming on:

MS Windows XP
Python 2.6

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T08:36:14+00:00Added an answer on May 23, 2026 at 8:36 am

    The Windows stores its system wide proxy in the registry, look in the the HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings. You can use the Python _winreg module to change it (or just winreg if you use Python 3). Here is a sample code

    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
    set_key('ProxyServer', u'X.X.X.X:8080')
    

    To disable it you can just need to set ProxyEnable key to 0:

    set_key('ProxyEnable', 0)
    

    After the script runs the browsers will still have the old proxy stored in-memory, so you need to restart them so they can re-read the new proxy settings from the registry. I found this to be very annoying so I converted this snippet to Python.

    import ctypes
    
    INTERNET_OPTION_REFRESH = 37
    INTERNET_OPTION_SETTINGS_CHANGED = 39
    
    internet_set_option = ctypes.windll.Wininet.InternetSetOptionW
    
    internet_set_option(0, self.INTERNET_OPTION_REFRESH, 0, 0)
    internet_set_option(0, self.INTERNET_OPTION_SETTINGS_CHANGED, 0, 0)
    

    This refreshes the Windows settings so all you have to do is hit F5 in your browser in order to it grab the new proxy settings.

    I’ve written a small script to switch my proxy on or off, the source in on Bitbucket:
    https://bitbucket.org/canassa/switch-proxy

    This should work with any browser that uses the Windows system-wide proxy (e.g.: Chrome, IE). Some browsers like Firefox uses a internal proxy settings. If you want to change these you will have figure out where they store their settings and write code to change it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have written a program that will etablish a network connection with a remote
I have a bash script that runs a simulation program written in Fortran 90,
I need help to identify the bug in my program that I have written
I have a website cgi-bin program that is written in c++. Unfortunately the website
I have a console program written in C# that I am using to send
I have written a program that handles signal for Floating point exception and I
I have written a program that reads in a File object (really an XML
I have written a program that invokes a system command from inside: #include <stdlib.h>
I have written a program that prints a table. I have not included the
Question: I have written a console program that uses the SQL server 2005 web

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.