Re: [Tutor] getting a webpage via python

2005-03-09 Thread Paul Tremblay
On Wed, Mar 09, 2005 at 08:29:46AM -0500, Kent Johnson wrote: > > Kent Johnson wrote: > >Paul Tremblay wrote: > > > >>So I just make a file called /etc/router_passwords and include > >>something like > >>WRT54G username password > >> > >>Then parse the file, and supply the info to the password ha

Re: [Tutor] getting a webpage via python

2005-03-09 Thread Kent Johnson
Kent Johnson wrote: Paul Tremblay wrote: So I just make a file called /etc/router_passwords and include something like WRT54G username password Then parse the file, and supply the info to the password handler? This is easy to do, and I guess it is secure. The book "Foundations of Python Network P

Re: [Tutor] getting a webpage via python

2005-03-08 Thread Kent Johnson
Paul Tremblay wrote: So I just make a file called /etc/router_passwords and include something like WRT54G username password Then parse the file, and supply the info to the password handler? This is easy to do, and I guess it is secure. No, it's not secure at all. In either case (password in the

Re: [Tutor] getting a webpage via python

2005-03-08 Thread Paul Tremblay
On Tue, Mar 08, 2005 at 01:42:40PM -0500, Kent Johnson wrote: > Date: Tue, 08 Mar 2005 13:42:40 -0500 > From: Kent Johnson <[EMAIL PROTECTED]> > User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) > Cc: python tutor > Subject: Re: [Tutor] getting a webpage via python >

Re: [Tutor] getting a webpage via python

2005-03-08 Thread Kent Johnson
Paul Tremblay wrote: This is giving me 401 error, authorization required. Here's what I have: auth_handler = urllib2.HTTPBasicAuthHandler() auth_handler.add_password('realm', '127.0.0.1', 'myname', 'password') opener = urllib2.build_opener(auth_handler) # ...and install it globally so it can be use

Re: [Tutor] getting a webpage via python

2005-03-08 Thread Paul Tremblay
On Tue, Mar 08, 2005 at 11:50:12AM -0500, Kent Johnson wrote: > > Paul Tremblay wrote: > > You can use urllib2 to do this. It is a little work to set it up to use > Basic authentication. Here is an example (slightly modified from the > urllib2 example page): > > import urllib2 > > # Create an

Re: [Tutor] getting a webpage via python

2005-03-08 Thread Kent Johnson
Paul Tremblay wrote: 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

Re: [Tutor] getting a webpage via python

2005-03-08 Thread Ewald Ertl
Hi Paul! As mentioned earlier by Kent in this group under the subject: Subject: Re: [Tutor] Downloading from http Mark Kels wrote: > On Sat, 12 Feb 2005 09:25:10 -0500, Jacob S. <[EMAIL PROTECTED]> wrote: > >>urllib or urllib2 or maybe httplib maybe? >> >>urlopen( url[, data]) > I

RE: [Tutor] getting a webpage via python

2005-03-08 Thread Eric Culpepper
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.pyt