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
File details
Details for the file asyncio-periodic-2019.2.tar.gz
.
File metadata
- Download URL: asyncio-periodic-2019.2.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1dfeaa51e27a1c0c46775100edd3e57aed7a8e2df0e6ab3a879ceefaf59da5f2 |
|
MD5 | 028eb21d5f7250012bf48022f6466c30 |
|
BLAKE2b-256 | e47bf3ecfed1ed9ef52395ffa908e9dd7c48130510f6e266fe591c9da4c9e167 |
File details
Details for the file asyncio_periodic-2019.2-py3-none-any.whl
.
File metadata
- Download URL: asyncio_periodic-2019.2-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f45cd105cd28cd3c315c53d2f18f73286f51ce317075a789158336b4fc1ee34 |
|
MD5 | 883bc3365c6c3fb52664704df513305a |
|
BLAKE2b-256 | bf69ac044fc8a82e72c32830dfef85ef7975de08771bfd676fd57e526ae03e71 |