I need to log in to multiple accounts at the same time, and I was advised to create a stream. How can I do this?
def startChecking(login, password):
session = startSession()
logIn(session, login, password)
while True:
lastData = findAll(session)
time.sleep(5)
lastChat = findAll(session)
if lastData == lastChat:
gg = 0
else:
print(f'{login}', lastChat['userSms'])
if __name__ == '__main__':
# There will be a for loop that will take the login and password
session = startSession()
logIn(session, 'login', 'password')
while True:
lastData = findAll(session)
time.sleep(5)
lastChat = findAll(session)
if lastData == lastChat:
gg = 0
else:
print('login\nNew message:', lastChat['userSms'])
The code will be something like this:
if __name__ == '__main__':
# There will be a for loop that will take the login and password
allAcc = list(collectionFunPay.find())
for i in range(0, len(allAcc)):
print(allAcc[i]['login'], allAcc[i]['password'])
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop) # An eternal cycle that must be performed continuously
loop.run_until_complete(startChecking(allAcc[i]['login'], allAcc[i]['password']))
But it doesn't work.