vinyguedess / onany

Event/Dispatch manager for Python3.6+ applications

Home Page:https://pypi.org/project/onany/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

OnAny... thing happening

Build

Maintainability

Test Coverage

OnAny is a simple yet powerful event manager library, where you can declare listeners and dispatch as much events as needed to them.

How To

To listen and dispatch events is very simple:

Should I wait all callbacks to end ?

Nope. You can "threadily" dispatch your events so they don't need to be waited for the main process.

Webhook listener

It's possible declare webhook rules to be dispatched as an inside event. This webhook events can be a powerful tool for communicating to third-party clients that an event is ended.

Listener rules:

  • route
    • type: str
    • description: API route
    • required
  • callback
    • type: callable/function
    • description: Receives request response object if needed

When dispatch or disthread is called is possible define some attributes to be sent in the external API call.

Attributes:

  • data
    • type: dict
    • description: JSON body
  • headers
    • type: dict
    • description: Dictionary declaring headers to be sent

Example:

About

Event/Dispatch manager for Python3.6+ applications

https://pypi.org/project/onany/

License:MIT License


Languages

Language:Python 97.7%Language:Makefile 2.3%