Entering username & password automatically using urllib.urlopen

James Matthews nytrokiss at gmail.com
Mon Oct 15 00:08:50 EDT 2007


if you want to hardcode the password in the url. What you need to do is
http:username:password at www.passwordprotectedsite.com

On 10/14/07, Diez B. Roggisch <deets at nospam.web.de> wrote:
>
> rodrigo schrieb:
> > I am trying to retrieve a password protected page using:
> >
> > get = urllib.urlopen('http://password.protected.url"').read()
> >
> > While doing this interactively, I'm asked for  the username, then the
> > password at the terminal.
> > Is there any way to do this non-interactively? To hardcode the user/
> > pass into the script so I can get the page automatically?
> >
> > (This is not a cracking attempt, I am trying to retrieve a page I have
> > legitimate access to, just doing it automatically when certain
> > conditions are met.)
>
> Is that HTTP-auth? Then this might help:
>
> http://www.voidspace.org.uk/python/articles/authentication.shtml
>
> BTW, use urllib2.
>
> Diez
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
http://www.goldwatches.com/
http://www.jewelerslounge.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20071014/4d1b891b/attachment.html>


More information about the Python-list mailing list