Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from random import randint
- class Account:
- def __init__(self, email, passw):
- self.email = email
- self.passw = passw
- class AccountLoader:
- def __init__(self):
- self.accounts = []
- @staticmethod
- def parse_line_to_account(line):
- _line = line.split(':')
- return _line[0], _line[1]
- def load_accounts_from_file(self):
- _accounts_list = [line.strip() for line in open('accounts.txt')]
- for _account in _accounts_list:
- self.accounts.append(Account(*self.parse_line_to_account(_account)))
- def get_random_account(self):
- r = randint(0, len(self.accounts))
- return self.accounts[r-1]
- al = AccountLoader()
- al.load_accounts_from_file()
- #Example
- for i in range(1,10):
- #10 razy randomowe konto chcemy
- random_account = al.get_random_account()
- print(random_account.email, random_account.passw)
- #przykładowo
- #element.send_keys(random_account.email)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement