Skip to content

vd2org/periodic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

periodic

Simple tool for run asyncio tasks periodically.

Setup

pip install asyncio-periodic

Example usage

import asyncio
from datetime import datetime

from periodic import Periodic


async def periodically(param):
    print(datetime.now(), 'Yay!', param)
    await asyncio.sleep(1)
    print(datetime.now(), 'Done!')
    
async def main():
    p = Periodic(3, periodically, 'Periodically!')
    await p.start()
    
if __name__ == "__main__":
    loop = asyncio.get_event_loop()
    loop.create_task(main())
    loop.run_forever()

Testing

Code tested automatically using travis. You can see build status here.

To test code manually install and run pytest:

pip install pytest
python -m pytest tests/

About

Python asyncio periodic tasks.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages