loop = asyncio.get_event_loop()
loop.create_task(background_task())
async def main():
asyncio.create_task(background_task())
do_somethin_other
loop = asyncio.get_event_loop()
loop.run_until_complete(main())
loop.close()
async def background_task():
while True:
if some_messages_ready_to_send:
send_messages
await asyncio.sleep(60)
asyncio.create_task(background_task())
main_script_code...
import hashlib
def md5(s):
return hashlib.md5(s.encode("utf-8")).hexdigest()
datas["pw2"] = md5(datas["salt"]+md5(datas["PW"]))