aiopg-listen-0.0.6
توضیحات
Helps to use PostgreSQL listen/notify with aiopg
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | aiopg-listen-0.0.6 |
| نام | aiopg-listen |
| نسخه کتابخانه | 0.0.6 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Yury Pliner |
| ایمیل نویسنده | yury.pliner@gmail.com |
| آدرس صفحه اصلی | https://github.com/Pliner/aiopg-listen |
| آدرس اینترنتی | https://pypi.org/project/aiopg-listen/ |
| مجوز | MIT |
# aiopg-listen
This library simplifies usage of listen/notify with [aiopg](https://github.com/aio-libs/aiopg):
1. Handles lost of a connection
1. Simplifies processing notifications from multiple channels
1. Setups a timeout for receiving a notification
1. Allows to receive all notifications/only last notification depends on `ListenPolicy`.
```python
import asyncio
import aiopg
import aiopg_listen
async def handle_notifications(notification: aiopg_listen.NotificationOrTimeout) -> None:
print(f"{notification} has been received")
listener = aiopg_listen.NotificationListener(aiopg_listen.connect_func())
listener_task = asyncio.create_task(
listener.run(
{"channel": handle_notifications},
policy=aiopg_listen.ListenPolicy.LAST,
notification_timeout=1
)
)
async with aiopg.connect() as connection, connection.cursor() as cursor:
for i in range(42):
await cursor.execute(f"NOTIFY simple, '{i}'")
```
## v0.0.6 (2022-11-02)
* [Add python 3.11 support](https://github.com/Pliner/aiopg-listen/pull/144)
## v0.0.5 (2021-11-02)
* [Support async-timeout 4.0+](https://github.com/Pliner/aiopg-listen/pull/32)
## v0.0.4 (2021-09-08)
* Reexport explicitly [#18](https://github.com/Pliner/aiopg-listen/pull/18)
## v0.0.3 (2021-08-10)
* Allow suppressing timeout by aiopg_listen.NO_TIMEOUT [#9](https://github.com/Pliner/aiopg-listen/pull/9)
* Fix typing for python 3.8 [#11](https://github.com/Pliner/aiopg-listen/pull/11)
## v0.0.2 (2021-07-25)
* Add `aiopg_listen.connect_func` to simplify initialization [#5](https://github.com/Pliner/aiopg-listen/pull/5)
* Rename consumer to listener [#6](https://github.com/Pliner/aiopg-listen/pull/6)
* Do not crash if handler fails [#7](https://github.com/Pliner/aiopg-listen/pull/7)
## v0.0.1 (2021-07-25)
* A first version
نیازمندی
| مقدار | نام |
|---|---|
| >=1.4.0 | aiopg |
| <5.0,>=3.0 | async-timeout |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.8 | Python |
نحوه نصب
نصب پکیج whl aiopg-listen-0.0.6:
pip install aiopg-listen-0.0.6.whl
نصب پکیج tar.gz aiopg-listen-0.0.6:
pip install aiopg-listen-0.0.6.tar.gz