Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

aiopg-listen

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

aiopg-listen

Helps to use PostgreSQL listen/notify with aiopg

  • 0.0.7
  • PyPI
  • Socket score

Maintainers
1

aiopg-listen

This library simplifies usage of listen/notify with aiopg:

  1. Handles lost of a connection
  2. Simplifies processing notifications from multiple channels
  3. Setups a timeout for receiving a notification
  4. Allows to receive all notifications/only last notification depends on ListenPolicy.
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.7 (2023-03-09)

v0.0.6 (2022-11-02)

v0.0.5 (2021-11-02)

v0.0.4 (2021-09-08)

  • Reexport explicitly #18

v0.0.3 (2021-08-10)

  • Allow suppressing timeout by aiopg_listen.NO_TIMEOUT #9
  • Fix typing for python 3.8 #11

v0.0.2 (2021-07-25)

  • Add aiopg_listen.connect_func to simplify initialization #5
  • Rename consumer to listener #6
  • Do not crash if handler fails #7

v0.0.1 (2021-07-25)

  • A first version

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc