stupid question about html page

L

luca72

hello
with webbrowser i open the html or php etc page, how i can save the
opened page with python?

Thanks

Luca
 
M

Mithrandir

hello
with webbrowser i open the html or php etc page, how i can save the
opened page with python?

Thanks

Luca

Not sure of a way to capture info from a browser (like Firefox.) I know
though that you can save the source of an page with:

import urllib
urllib.urlretrieve("http://www.example.com/", "Fun.html")

You still need a web browser to read it formatted. (If you are on a web
page in Firefox, and want to save it, click File>Save Page As...)

If you want to save a picture from the Net see:

http://www.daniweb.com/code/snippet216796.html

Good luck!

--
People should read more.
https://secure.wikimedia.org/wikipedia/en/wiki/User:MithrandirAgain
"All that is gold does not glitter,
not all those who wander are lost;
the old that is strong does not wither,
deep roots are not reached by the frost.
From the ashes a fire shall be woken,
a light from the shadows shall spring;
renenwed shall be blade that was broken,
the crownless again shall be king."
 
L

luca72

Not sure of a way to capture info from a browser (like Firefox.) I know
though that you can save the source of an page with:

import urllib
urllib.urlretrieve("http://www.example.com/", "Fun.html")

You still need a web browser to read it formatted. (If you are on a web
page in Firefox, and want to save it, click File>Save Page As...)

If you want to save a picture from the Net see:

http://www.daniweb.com/code/snippet216796.html

Good luck!

--
People should read more.https://secure.wikimedia.org/wikipedia/en/wiki/User:MithrandirAgain
"All that is gold does not glitter,
not all those who wander are lost;
the old that is strong does not wither,
deep roots are not reached by the frost.
From the ashes a fire shall be woken,
a light from the shadows shall spring;
renenwed shall be blade that was broken,
the crownless again shall be king."

Thanks for your reply, the problem is that i don't want to save it
with file-> save.
there is any way to save the page by script.
please note that when i save the page with firefox, it save the html
page and also make a folder with the script used in the page, how i
can make it also with python script?
Thanks

Luca
 
D

drygal

Thanks for your reply, the problem is that i don't want to save it
with file-> save.
there is any way to save the page by script.
please note that when i save the page with firefox, it save the html
page and also make a folder with the script used in the page, how i
can make it also with python script?
Thanks

Luca

It is not quite possible. If python is used, it runs behind the scenes
and generates html send to the browser. You could only see the .py
file if the server was poorly configured so it would show the content
of the .py file instead of actually executing it to generate the html
code, but in that case you would not see any page either.

Regards,
 
D

Dennis Lee Bieber

Thanks for your reply, the problem is that i don't want to save it
with file-> save.
there is any way to save the page by script.
please note that when i save the page with firefox, it save the html
page and also make a folder with the script used in the page, how i
can make it also with python script?
Thanks
You would have to do the same thing Firefox (or other browser
does)... Save the main page HTML in a file, then parse the contents for
anything that refers to some OTHER file (CSS includes, images) and
request the server to send those, one at a time, and you'd have to then
save each of those.

Note that anything that is dynamically generated (like a page that
displays the current sidereal time, and is not using locally-executed
javascript) will be saved as a static text page.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,062
Latest member
OrderKetozenseACV

Latest Threads

Top