script to Login a website

wachkama at gmail.com wachkama at gmail.com
Wed Jul 31 18:50:45 CEST 2013


On Wednesday, July 31, 2013 12:21:59 PM UTC-4, John Gordon wrote:
> 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
> 
> all somehow?
> 
> 
> 
> 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"

Hi John 
let me answer your questions 
the user.txt file has one user name on each line and so does the password.txt. with this in mind each user will attempt to log in with all the passwords on password.txt file. when it gets to the end of the line it will go to the next user in users.txt and do the same i.e attempt to log in with all the passwords in the file.
So to your second question I will use all the users one after the other attempting to log in.
I am able to get each user to use "x" number of passwords in the password.txt that part works fine. The login section is where I am stuck ?

Sam



More information about the Python-list mailing list