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)
# Prepare the loop
loop = asyncio.get_eventloop()
async def work():
await watcher.setup(loop)
for _i in range(10):
# Pick the 10 first events
event = await watcher.get_event()
print(event)
watcher.close()
loop.run_until_completed(work())
loop.stop()
loop.close()
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')
Metadata
Release files for aionotify 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| aionotify-0.2.0.tar.gz | 7.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| aionotify-0.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 13.8 kB
Release files / aionotify-0.2.0.tar.gz
| Download URL | aionotify-0.2.0.tar.gz |
|---|---|
| Size | 7.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
64b702ad0eb115034533f9f62730a9253b79f5ff0fbf3d100c392124cdf12507
|
|
BLAKE2b-256 checksum How to use checksums |
57c0237d434870a024a16d89751ec9f4e5340a6d84d49ccb1ab738b3fdee907a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / aionotify-0.2.0-py3-none-any.whl
| Download URL | aionotify-0.2.0-py3-none-any.whl |
|---|---|
| Size | 6.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
385e1becfaac2d9f4326673033d53912ef9565b6febdedbec593ee966df392c6
|
|
BLAKE2b-256 checksum How to use checksums |
d4ca104c3332c6c9be78108840fb3b08f40cfd2c598df4ce1cd7eb999416825c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |