Entering username & password automatically using urllib.urlopen

byte8bits at gmail.com byte8bits at gmail.com
Sun Oct 14 16:48:26 CEST 2007


On Oct 13, 11:41 pm, rodrigo <rodrigo... 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

The pexpect module works nicely for automating tasks that normally
require user interaction.




More information about the Python-list mailing list