octomachinery.github.models.events module#

Generic GitHub event containers.

class octomachinery.github.models.events.GitHubEvent(name: str, payload: Union[Mapping[str, Any], bytes, str])[source]#

Bases: object

Representation of a generic source-agnostic GitHub event.

async dispatch_via(*routers: OctomachineryRouterBase, ctx: Union[Mapping[str, Any], None] = None) Iterable[Any][source]#

Invoke this event handlers from different routers.

classmethod from_file(event_name: str, event_path: Union[Path, str]) GitHubEvent[source]#

Construct a GitHubEvent instance from event name and file.

classmethod from_fixture(event_fixture_path: Union[Path, str], *, event: Optional[str] = None) GitHubEvent[source]#

Make a GitHubEvent from a fixture and an optional name.

classmethod from_fixture_fd(event_fixture_fd: TextIO, *, event: Optional[str] = None) GitHubEvent[source]#

Make a GitHubEvent from a fixture fd and an optional name.

classmethod from_gidgethub(event: Event) GitHubEvent[source]#

Construct GitHubEvent from from GidgetHub Event.

name: str#

Event name.

payload: Mapping[str, Any]#

Event payload object.

to_gidgethub() Event[source]#

Produce GidgetHub Event from self.

class octomachinery.github.models.events.GitHubWebhookEvent(name: str, payload: Union[Mapping[str, Any], bytes, str], delivery_id: Union[str, UUID])[source]#

Bases: GitHubEvent

Representation of a GitHub event arriving by HTTP.

delivery_id: UUID#

A unique UUID4 identifier of the event delivery on GH side.

classmethod from_file(event_name: str, event_path: Union[Path, str]) GitHubWebhookEvent[source]#

Explode when constructing from file.

classmethod from_fixture(event_fixture_path: Union[Path, str], *, event: Optional[str] = None) GitHubWebhookEvent[source]#

Make a GitHubWebhookEvent from fixture and optional name.

classmethod from_fixture_fd(event_fixture_fd: TextIO, *, event: Optional[str] = None) GitHubWebhookEvent[source]#

Make GitHubWebhookEvent from fixture fd and optional name.

classmethod from_gidgethub(event: Event) GitHubWebhookEvent[source]#

Construct GitHubWebhookEvent from from GidgetHub Event.

classmethod from_http_request(http_req_headers: Mapping[str, str], http_req_body: bytes)[source]#

Make a GitHubWebhookEvent from HTTP req headers and body.

to_gidgethub() Event[source]#

Produce GidgetHub Event from self.