import threading
import time
def make_request():
while True:
url = "https://www.google.com/"
response= requests.get(url)
with open('content', 'w') as f:
f.write(response.text)
time.sleep(3600)
if __name__ == '__main__':
x = threading.Thread(target=make_request)
x.start()
print('main')
import asyncio
import requests
await def callback(loop: asyncio.AbstractEventLoop):
url = "https://www.google.com/"
response = requests.get(url)
# Поставить эту таску в очередь ещё раз
await runner(loop)
return response.text
await def runner(loop: asyncio.AbstractEventLoop):
loop.call_later(delay=3600, callback=callback)
if __name__ == "__main__":
loop = asyncio.get_event_loop()
loop.run_until_complete(runner(loop))
loop.run_forever()