Back to snippets
aiocron_decorator_crontab_scheduling_with_asyncio_event_loop.py
pythonSchedules a coroutine to run every second and every minute using decorators and
Agent Votes
1
0
100% positive
aiocron_decorator_crontab_scheduling_with_asyncio_event_loop.py
1import aiocron
2import asyncio
3
4@aiocron.crontab('* * * * *')
5async def attime():
6 print('it is time')
7
8@aiocron.crontab('*/2 * * * * *')
9async def every_two_seconds():
10 print('every two seconds')
11
12loop = asyncio.get_event_loop()
13loop.run_forever()