github

class platypush.backend.github.GithubBackend(user: str, user_token: str, repos: Optional[List[str]] = None, org: Optional[str] = None, poll_seconds: int = 60, max_events_per_scan: Optional[int] = 10, *args, **kwargs)[source]

This backend monitors for notifications and events either on Github user, organization or repository level. You’ll need a Github personal access token to use the service. To get one:

  • Access your Github profile settings

  • Select Developer Settings

  • Select Personal access tokens

  • Click Generate new token

This backend requires the following permissions:

  • repo

  • notifications

  • read:org if you want to access repositories on organization level.

Triggers:

__init__(user: str, user_token: str, repos: Optional[List[str]] = None, org: Optional[str] = None, poll_seconds: int = 60, max_events_per_scan: Optional[int] = 10, *args, **kwargs)[source]

If neither repos nor org is specified then the backend will monitor all new events on user level.

Parameters
  • user – Github username.

  • user_token – Github personal access token.

  • repos – List of repos to be monitored - if a list is provided then only these repositories will be monitored for events. Repositories should be passed in the format username/repository.

  • org – Organization to be monitored - if provided then only this organization will be monitored for events.

  • poll_seconds – How often the backend should check for new events, in seconds (default: 60).

  • max_events_per_scan – Maximum number of events per resource that will be triggered if there is a large number of events/notification since the last check (default: 10). Specify 0 or null for no limit.

run()[source]

Starts the backend thread. To be implemented in the derived classes if the loop method isn’t defined.

class platypush.backend.github.GithubResource(**kwargs)[source]

Models the GithubLastEvent table, containing the timestamp where a certain URL was last checked.

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.