[Tutor] getting a webpage via python
Eric Culpepper
eculpepper at hcc-care.com
Tue Mar 8 17:30:49 CET 2005
You could use the builtin modules like urllib2, httplib, or you could use John Lee's spifftastic module "mechanize". I use mechanize a lot for automating downloading files from various partner websites my company has relations with.
http://docs.python.org/lib/module-httplib.html
http://docs.python.org/lib/module-urllib2.html
http://wwwsearch.sourceforge.net/mechanize/
Good luck.
Eric Culpepper
eculpepper at hcc-care.com
-----Original Message-----
From: tutor-bounces at python.org [mailto:tutor-bounces at python.org]On
Behalf Of Paul Tremblay
Sent: Tuesday, March 08, 2005 10:21 AM
To: python tutor
Subject: [Tutor] getting a webpage via python
Is there a simple way to get a web page with python? I have done no
network programming with python before.
My router (a Linksys 54G model) stores the IP/MAC addresss in a web
page. There is no way for me to access them except through the web.
Righ now, I am using this code:
command = 'lynx -reload -auth %s:%s -source http://%s/DHCPTable.asp > %s' % (
self.__log_name, self.__log_password, self.__router_address, temp_out1)
(exit_status, out_text) = commands.getstatusoutput(command)
The lynx terminal browser dumps the raw HTML page to the out_text, and I
can then parse it.
I would like to make the code independent of lynx, if possible.
Thanks
Paul
--
************************
*Paul Tremblay *
*phthenry at iglou.com *
************************
_______________________________________________
Tutor maillist - Tutor at python.org
http://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list