Question

Well by using WebBrowser i want to open for example the firefox browser and point him to a simple address like example.com ! The following code is enough for that job !

import webbrowser
url = 'http://www.example.com/'
webbrowser.open_new(url)

But i want my webbrowser script to open a custom hosts file not the one located here : c:\windows\system32\drivers\etc\hosts So is it possible to change that location using a python function or a arg through firefox.exe ?

Edit : Can we maybe be able to achieve it through the windows registry ?

   HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters
   %SystemRoot%\System32\drivers\etc

if i change it to some other folder would that work ?

Was it helpful?

Solution

webbrowser module looks very minimalistic, I don't think is is possible.

But you could use HTTP proxy like squid, to which you can give different hostsfile.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top