faqts : Computers : Programming : Languages : Python : Common Problems

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

7 of 19 people (37%) answered Yes
Recently 5 of 10 people (50%) answered Yes

Entry

How can I change the Proxy Setting in MSIE from python?

Jul 23rd, 2000 23:58
unknown unknown, Alex Martelli


This is what MSDN has to say on the issue, after explaining how to find 
out what your usual defaults for proxy are (i.e., Internet 
Options/Connection/Proxy Server):
If you intend to use a proxy other than that named in the dialog box, 
set the AccessType property to icNamedProxy (2). Then set the Proxy 
property to the name of the proxy, as shown in the code below:
Inet1.Proxy = "myProxyName"
Inet1.AccessType = icNamedProxy
On the other hand, if you are content to use the default proxy (as
determined by your computer's registry), ignore the Proxy property, and
simply set the AccessType to icUseDefault (0).
The settings for AccessType are shown in the following table:
Constant     Value           Description
icUseDefault 0 (Default)     Use Defaults. The control uses 
                             default settings found in the
                             registry to access the Internet.
icDirect     1               Direct to Internet. The control has a 
                             direct connection to the Internet.
icNamedProxy 2               Named Proxy. Instructs the control to use 
                             the proxy server specified in the
                             Proxy property.
MSDN mentions this in a Visual Basic context, but of course it should 
all work just as well from Python.
As an aside: being an information junky, I just LOVE the MSDN. Mostly 
for Windows stuff, OK, but I also find it useful as an online searchable 
reference to HTML, the C++ standard library, Unicode character tables, 
etc, etc.  Besides reading it at msdn.microsoft.com, you can probably 
get slightly old extra ones from Windows developer friends for free -- 
MS puts one out 4 times a year, and you don't really need the latest 
one:-).