octomachinery.github.models.events module

Generic GitHub event containers.

class octomachinery.github.models.events.GitHubEvent(name: str, payload)[source]

Bases: object

Representation of a generic source-agnostic GitHub event.

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

Invoke this event handlers from different routers.

classmethod from_file(event_name: str, event_path: Union[pathlib.Path, str]) → octomachinery.github.models.events.GitHubEvent[source]

Construct a GitHubEvent instance from event name and file.

classmethod from_fixture(event_fixture_path: Union[pathlib.Path, str], *, event: Optional[str] = None) → octomachinery.github.models.events.GitHubEvent[source]

Make a GitHubEvent from a fixture and an optional name.

classmethod from_fixture_fd(event_fixture_fd: TextIO, *, event: Optional[str] = None) → octomachinery.github.models.events.GitHubEvent[source]

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

classmethod from_gidgethub(event: gidgethub.sansio.Event) → octomachinery.github.models.events.GitHubEvent[source]

Construct GitHubEvent from from GidgetHub Event.

name: str = None

Event name.

payload: dict = None

Event payload object.

to_gidgethub() → gidgethub.sansio.Event[source]

Produce GidgetHub Event from self.

class octomachinery.github.models.events.GitHubWebhookEvent(name: str, payload, delivery_id)[source]

Bases: octomachinery.github.models.events.GitHubEvent

Representation of a GitHub event arriving by HTTP.

delivery_id: uuid.UUID = None

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

classmethod from_file(event_name: str, event_path: Union[pathlib.Path, str]) → octomachinery.github.models.events.GitHubWebhookEvent[source]

Explode when constructing from file.

classmethod from_fixture(event_fixture_path: Union[pathlib.Path, str], *, event: Optional[str] = None) → octomachinery.github.models.events.GitHubWebhookEvent[source]

Make a GitHubWebhookEvent from fixture and optional name.

classmethod from_fixture_fd(event_fixture_fd: TextIO, *, event: Optional[str] = None) → octomachinery.github.models.events.GitHubWebhookEvent[source]

Make GitHubWebhookEvent from fixture fd and optional name.

classmethod from_gidgethub(event: gidgethub.sansio.Event) → octomachinery.github.models.events.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() → gidgethub.sansio.Event[source]

Produce GidgetHub Event from self.