Simple tool for run asyncio tasks periodically.
Project description
# periodic
Simple tool for run asyncio tasks periodically.
# Setup
```bash
pip install asyncio-periodic
```
# Example usage
```python
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()
```
Simple tool for run asyncio tasks periodically.
# Setup
```bash
pip install asyncio-periodic
```
# Example usage
```python
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()
```
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for asyncio_periodic-2019.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f45cd105cd28cd3c315c53d2f18f73286f51ce317075a789158336b4fc1ee34 |
|
MD5 | 883bc3365c6c3fb52664704df513305a |
|
BLAKE2b-256 | bf69ac044fc8a82e72c32830dfef85ef7975de08771bfd676fd57e526ae03e71 |