events_protocol.server.handler

Submodules

Package Contents

class events_protocol.server.handler.SafeEventHandler

Bases: events_protocol.server.handler.event_handler.AsyncEventHandler

Defines a safe event handler

event_namestr
Event endpoint. It should contain only letters and respect the following format:
  • {{name}}:{{name}}

event_versionint

Event version

Change the __safe_event_handler to contain the calls to the desired service The run method will be override to create a new handler

SafeHandler

event_name :str
event_version :typing.Union[None, int]
async classmethod handle(cls, event: Event)

Method that will safely handle the current event in the events_protocol library

event: Event

Event sent by the user

ResponseEvent

Response event containing the result of the service

async classmethod run(cls, event: Event)
async classmethod __safe_event_handler(cls, event: Event)

Implements the integrity verification of the payload and runs the service

event: Event

Event sent by the user

ResponseEvent

Response event containing the result of the service

class events_protocol.server.handler.EventHandler

Bases: abc.ABC

event_name :str
event_version :typing.Union[None, int]
_SCHEMA :CamelPydanticMixin
__post_init__(self)
abstract handle(cls, event: RequestEvent)
classmethod parse_event(cls, event: Event)