Asyncio-powered inotify library
Project description
aionotify is a simple, asyncio-based inotify library.
Its use is quite simple:
import asyncio
import aionotify
# Setup the watcher
watcher = aionotify.Watcher()
watcher.watch(alias='logs', path='/var/log', flags=aionotify.Flags.MODIFY)
async def work():
await watcher.setup()
for _i in range(10):
# Pick the 10 first events
event = await watcher.get_event()
print(event)
watcher.close()
asyncio.run(work())
Links
Package at https://pypi.python.org/pypi/aionotify/
Continuous integration at https://travis-ci.org/rbarrois/aionotify/
Events
An event is a simple object with a few attributes:
name: the path of the modified file
flags: the modification flag; use aionotify.Flags.parse() to retrieve a list of individual values.
alias: the alias of the watch triggering the event
cookie: for renames, this integer value links the “renamed from” and “renamed to” events.
Watches
aionotify uses a system of “watches”, similar to inotify.
A watch may have an alias; by default, it uses the path name:
watcher = aionotify.Watcher()
watcher.watch('/var/log', flags=aionotify.Flags.MODIFY)
# Similar to:
watcher.watch('/var/log', flags=aionotify.Flags.MODIFY, alias='/var/log')
A watch can be removed by using its alias:
watcher = aionotify.Watcher()
watcher.watch('/var/log', flags=aionotify.Flags.MODIFY)
watcher.unwatch('/var/log')
Project details
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
Hashes for aionotify-0.3.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25816a9eef030c774beaee22189a24e29bc43f81cebe574ef723851eaf89ddee |
|
MD5 | ac46fcc2976f20838e23ebd5a8784aa5 |
|
BLAKE2b-256 | 6b6ab43cb72f72ad650225854b630ab569b74071764fb562b88264aed4c9e350 |