script to Login a website
gordon at panix.com
Wed Jul 31 18:21:59 CEST 2013
In <ece5f6b0-16da-4c3a-83d1-6340cb10cb9d at googlegroups.com> wachkama at gmail.com writes:
> I have created a script to log in a website. It gets its username and
> password from two files, then log's in with this credentials. My code is
> not showing me what username it is using to login from the file. And I am
> not sure if it is even opening up the url and prompting for login. I am
> stuck can someone help me ?
How is the data in 'users.txt' and 'password.txt' organized? Given the
filenames, I would expect that 'users.txt' contains one username on each
line, and 'password.txt' contains one password on each line, with the
first username belonging with the first password, the second username
belonging with the second password, and so on.
Is this correct?
If so, that raises the question of how to handle multiple usernames and
passwords. Do you just want to use one, or are you supposed to use them
Anyway, to begin to solve your problem, I'd copy just the file-reading code
into a separate program and add plenty of print statements to make sure it
works correctly. Once you have that fixed, then you can worry about the
web login stuff.
And when you read the contents of each file, be aware that the newlines
at the end of each line are included. If you don't want these, be sure
to call the rstrip() method to remove traling whitespace.
John Gordon A is for Amy, who fell down the stairs
gordon at panix.com B is for Basil, assaulted by bears
-- Edward Gorey, "The Gashlycrumb Tinies"
More information about the Python-list