Reference

async mechanical_bull.event_loop.handle_connection(client: BovineClient, handlers: list)[source]

Opens an event source and applies all handlers to captured events. Can be used as a task, i.e.

task = asyncio.create_task(handle_connection(client, handlers))
# ...
task.cancel()
Parameters:

handlers – list of methods taking at argument the BovineClient client and a dictionary representing the ActivityPub activity.

async mechanical_bull.event_loop.handle_connection_with_reconnect(client: BovineClient, handlers: list, client_name: str = 'BovineClient', wait_time: int = 10)[source]

As handle_connection, but automatically recoonects after wait_time many seconds.

Parameters:
  • client_name – Used for logging purpose

  • wait_time – Time in seconds to wait between connection attempts.