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 (
str
) – 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.
Methods Summary
Create an anonymous client.
Create a client authenticated as the GitHub App.
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:
- create_app_client()#
Create a client authenticated as the GitHub App.
- Returns:
The app 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 (
str
) – 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: