Main class: GithubIntegration

class github.GithubIntegration.GithubIntegration(integration_id: int | str | None = None, private_key: str | None = None, base_url: str = 'https://api.github.com', *, timeout: int = 15, user_agent: str = 'PyGithub/Python', per_page: int = 30, verify: bool | str = True, retry: int | Retry | None = None, pool_size: int | None = None, seconds_between_requests: float | None = 0.25, seconds_between_writes: float | None = 1.0, jwt_expiry: int = 300, jwt_issued_at: int = -60, jwt_algorithm: str = 'RS256', auth: AppAuth | None = None, lazy: bool = False, api_version: str | None = None)

Main class to obtain tokens for a GitHub integration.

Parameters:
  • integration_id – int deprecated, use auth=github.Auth.AppAuth(…) instead

  • private_key – string deprecated, use auth=github.Auth.AppAuth(…) instead

  • base_url – string

  • timeout – integer

  • user_agent – string

  • per_page – int

  • verify – boolean or string

  • retry – int or urllib3.util.retry.Retry object

  • pool_size – int

  • seconds_between_requests – float

  • seconds_between_writes – float

  • jwt_expiry – int deprecated, use auth=github.Auth.AppAuth(…) instead

  • jwt_issued_at – int deprecated, use auth=github.Auth.AppAuth(…) instead

  • jwt_algorithm – string deprecated, use auth=github.Auth.AppAuth(…) instead

  • auth – authentication method

  • lazy – completable objects created from this instance are lazy, as well as completable objects created from those, and so on

  • api_version – string, GitHub API version to use (see https://docs.github.com/en/rest/about-the-rest-api/api-versions). Note that some PyGithub methods might downgrade this version if it is not supported by the implementation. Set to None to not specify any version

withLazy(lazy: bool) GithubIntegration

Create a GithubIntegration instance with identical configuration but the given lazy setting.

Parameters:

lazy – completable objects created from this instance are lazy, as well as completable objects created from those, and so on

Returns:

new Github instance

close() None

Close connections to the server. Alternatively, use the GithubIntegration object as a context manager:

with github.GithubIntegration(...) as gi:
  # do something
property requester: Requester

Return my Requester object.

For example, to make requests to API endpoints not yet supported by PyGitHub.

create_jwt(expiration: int | None = None) str

Create a signed JWT https://docs.github.com/en/developers/apps/building-github-apps/authenticating-with-github-apps#authenticating-as-a-github-app

get_access_token(installation_id: int, permissions: dict[str, str] | None = None) InstallationAuthorization
Calls:

POST /app/installations/{installation_id}/access_tokens <https://docs.github.com/en/rest/apps/apps#create-an-installation-access-token-for-an-app>

get_installation(owner: str, repo: str) Installation

Deprecated by get_repo_installation.

Calls:

`GET /repos/{owner}/{repo}/installation <https://docs.github.com/en/rest/reference/apps#get-a-repository-

installation-for-the-authenticated-app>`

get_installations() PaginatedList[Installation]
Calls:

GET /app/installations <https://docs.github.com/en/rest/reference/apps#list-installations-for-the-authenticated-app>

get_org_installation(org: str) Installation
Calls:

GET /orgs/{org}/installation <https://docs.github.com/en/rest/apps/apps#get-an-organization-installation-for-the-authenticated-app>

get_repo_installation(owner: str, repo: str) Installation
Calls:

GET /repos/{owner}/{repo}/installation <https://docs.github.com/en/rest/reference/apps#get-a-repository-installation-for-the-authenticated-app>

get_user_installation(username: str) Installation
Calls:

GET /users/{username}/installation <https://docs.github.com/en/rest/apps/apps#get-a-user-installation-for-the-authenticated-app>

get_app_installation(installation_id: int) Installation
Calls:

GET /app/installations/{installation_id} <https://docs.github.com/en/rest/apps/apps#get-an-installation-for-the-authenticated-app>

get_app() GithubApp
Calls:

GET /app