Entering username & password automatically using urllib.urlopen

Daniel Larsson daniel.j.larsson at gmail.com
Mon Oct 15 05:13:48 CEST 2007


You form the URL thus:

http://<user>:<password>@<host>:<port>/<url-path>

This is defined in RFC 1738 <http://www.faqs.org/rfcs/rfc1738.html>

On 10/14/07, rodrigo <rodrigo.cr at gmail.com> wrote:
>
> 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.)
>
> Thanks,
>
> Rodrigo
>
> --
> http://mail.python.org/mailman/listinfo/python-list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20071015/91b75d6a/attachment.html>


More information about the Python-list mailing list