tags:

views:

31

answers:

1

Hi All I would like to use python webbrowser to access a secure https page and save it into a file.

Am I right if I say that with webbrowser control is not possible to save an entire web page but only opening a URL? I didn't see any 'save' method.

Other than this, the page I want to use is a secure http page and I don't know how to automatically provide username and password for authentication into my script. Can you help me in solving one of the 2 issues above?

Thank you very much Mn

A: 
  1. Save means "Write a file to the disk". Of course there's no "save" method. The library opens the URL so your program can read it. Period. If your program wants to write it to disk, that's not part of reading a URL, so it's not part of browsing.

  2. Use urllib2 for this. Not the webbrowser. It's much, much simpler.

  3. Read http://stackoverflow.com/questions/1014570/python-authentication-with-urllib2 for help in using urllib2.

S.Lott
Hi S.Thank you very much for your response indeed.The reason why I want to use webbrowser is because the page I want to download I realized that is rendered by a js script.If I use Firefox->File->Save As.. I can save the file and its content as I see it in the screen.Using UURLIB2 works fine but it saves a page lunching the script, not the data rendered.Probably what I need is some kind of handle to Firefox. I thought that webbrowser allows to do that and to automatically save a file.
Abruzzo Forte e Gentile
Pages rendered with javascript are a serious problem. Look at `curl` or some other utility to see if it can get the page after executing the JS.
S.Lott