I have a nasty error in my code which I can't figure out on my own. Here is my code:
accounts = open('usernames.txt').read().splitlines()
my_accounts = random.choice(accounts)
for x in my_accounts(starting_account, ending_account, 1):
payload = { 'user_key': get_user_key(),
'terms': 'true',
'action': 'edit',
'page': 'simple',
'flow': 'TestA',
'dob': '1987-22-01',
'gender': 'f',
'name': str(x),
'password': create_password()}
r = requests.post(CONST_URL + end_point, headers=headers, cookies=cookies, data=payload, allow_redirects=False, verify=False)
if r.status_code == 302:
accounts_output = 'accounts.txt'
f = open(accounts_output, 'w')
user_output = (str(r.status_code) + ' Account created succesfully: ' + str(x) + ' ' + create_password())
f.write(user_output)
f.close()
else:
print(str(r.status_code) + ' Unable to connect to the server :/')
print(r.content)
When I try to run this I get the following error:
Traceback (most recent call last):
File "C:/Users/Google Drive/testing/moreTesting.py", line 66, in <module>
ms = accountCreator().account_creator(0, 5)
File "C:/Users/Pieperloy/Google Drive/testing/moreTesting.py", line 43, in account_creator
for x in my_accounts(starting_account, ending_account, 1):
TypeError: 'str' object is not callable
Also, yes I did try lookup the issue but didn't found anything that could help me with my particular case. Thanks in advance, have a great day
str
isn't defined as a variable somewhere? Otherwise, your code should workstr(ending_account)
andstr(starting_account)
, the code you wrote here doesn't. Please post the correct code snippet.my_accounts
?my_accounts
is not a function, it is a string.