github3_utils.apps¶
Functions and classes for GitHub apps.
Classes:
|
Class to aid switching contexts between the app itself and its installations. |
Functions:
|
Returns an iterator over all repositories the app is installed for. |
|
Create markdown footer links for a GitHub app. |
- class ContextSwitcher(client, private_key_pem, app_id)[source]¶
Bases:
objectClass to aid switching contexts between the app itself and its installations.
- Parameters
Attributes:
The integer identifier for this GitHub App.
The bytes of the private key for this GitHub App.
Methods:
Login as the GitHub app.
login_as_org_installation(organization)Login as an organization installation of a GitHub app, and return its installation ID.
login_as_repo_installation(owner, repository)Login as a repository installation of a GitHub app, and return its installation ID.
login_as_user_installation(username)Login as a user installation of a GitHub app, and return its installation ID.
- login_as_org_installation(organization)[source]¶
Login as an organization installation of a GitHub app, and return its installation ID.
New in version 0.5.0.
- login_as_repo_installation(owner, repository)[source]¶
Login as a repository installation of a GitHub app, and return its installation ID.
- iter_installed_repos(*, context_switcher=None, client=None, private_key_pem=None, app_id=None)[source]¶
Returns an iterator over all repositories the app is installed for.
- Parameters
context_switcher (
Optional[ContextSwitcher]) – AContextSwitcherused to switch contexts between the app itself and its installations. DefaultNone.client (
Optional[GitHub]) – The bytes of the private key for this GitHub App. DefaultNone.private_key_pem (
Optional[bytes]) – The bytes of the private key for this GitHub App. DefaultNone.app_id (
Optional[int]) – The integer identifier for this GitHub App. DefaultNone.
Either
context_switcheror all ofclient,private_key_pemandapp_idmust be provided.
Create markdown footer links for a GitHub app.
- Parameters
owner (
str) – The owner of the repository.name (
str) – The name of the repository.event_date (
Optional[date]) – The date on which the footer is being created. Determines the emoji shown. DefaultNone.type (
Literal['marketplace','app']) – Whether the footer is for a GitHub app or an item in the marketplace. Default'marketplace'.docs_url (
Optional[str]) – The URL of the app’s documentation. IfNoneno link will be shown. DefaultNone.
New in version 0.3.0.
- Return type