views:

209

answers:

1

I'm trying to use IE8 through COM to access a secured site (namely, SourceForge), in Python. Here is the script:

from win32com.client import gencache
from win32com.client import Dispatch
import pythoncom

gencache.EnsureModule('{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}', 0, 1, 1)


class SourceForge(object):
    def __init__(self, baseURL='https://sourceforget.net/', *args, **kwargs):
        super(SourceForge, self).__init__(*args, **kwargs)

        self.__browser = Dispatch('InternetExplorer.Application')
        self.__browser.Visible = True
        self.__browser.Navigate(baseURL)

    def run(self):
        while True:
            pythoncom.PumpMessages()

def main():
    sf = SourceForge()
    sf.run()

if __name__ == '__main__':
    main()

If I launch IE by hand, fine. If I launch the script, I get a generic error page "Internet Explorer cannot display this page". If I change baseURL to use http instead of https, the script works. I guess this is some security "feature". I tried adding the site to the list of trusted sites. I tried to enable IE scripting in the options for the Internet zone. Doesn't work. Google was no help.

So, does anybody know something about this ? Is there a mysterious option to enable or am I doomed ?

I'm on Windows XP SP3 BTW, Python 2.5 and pywin32 build 213.

+2  A: 

I can't open https://sourceforget.net/ -- not by hand, not by script.

Are you sure this link is right?

Mihail
I can't believe there *is* a http://sourceforget.net/ (without SSL). Silly me.
fraca7