GitHubAppClientFactory#
- class safir.github.GitHubAppClientFactory(*, id, key, name, http_client)#
Bases:
object
Factory for creating GitHub App clients authenticated either as an app or as an installation of that app.
- Parameters:
id (
int
) – The GitHub App ID.key (
str
) – The GitHub App private key.name (
str
) – The GitHub App name. This identifies the app in the user agent string, and is typically the name of the GitHub repository the app is built from (e.g.lsst-sqre/times-square
).http_client (
AsyncClient
) – The httpx client.
Notes
Gidgethub treats the application ID and installation ID as strings, but GitHub’s API appears to return them as integers. This class expects them to be integers and converts them to strings when calling Gidgethub.
Methods Summary
Create an anonymous client.
create_installation_client
(installation_id)Create a client authenticated as an installation of the GitHub App for a specific repository or organization.
create_installation_client_for_repo
(owner, repo)Create a client authenticated as an installation of the GitHub App for a specific repository or organization.
Create the GitHub App's JWT based on application configuration.
Methods Documentation
- create_anonymous_client()#
Create an anonymous client.
- Returns:
The anonymous client.
- Return type:
- async create_installation_client(installation_id)#
Create a client authenticated as an installation of the GitHub App for a specific repository or organization.
- Parameters:
installation_id (
int
) – The installation ID. This can be retrieved from theinstallation.id
field of a webhook payload or from theid
field of theGET "/repos/{owner}/{repo}/installation"
GitHub endpoint.- Returns:
The installation client.
- Return type:
- async create_installation_client_for_repo(owner, repo)#
Create a client authenticated as an installation of the GitHub App for a specific repository or organization.
- Parameters:
- Returns:
The installation client.
- Return type: