Back to Prefect

credentials

docs/integrations/prefect-github/api-ref/prefect_github-credentials.mdx

3.6.30.dev31.6 KB
Original Source

prefect_github.credentials

Credential classes used to perform authenticated interactions with GitHub

Classes

GitHubCredentials <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-github/prefect_github/credentials.py#L12" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

Block used to manage GitHub authentication.

Attributes:

  • token: the token to authenticate into GitHub.

Examples:

Load stored GitHub credentials:

python
from prefect_github import GitHubCredentials
github_credentials_block = GitHubCredentials.load("BLOCK_NAME")

Methods:

format_git_credentials <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-github/prefect_github/credentials.py#L35" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
format_git_credentials(self, url: str) -> str

Format and return the full git URL with GitHub credentials embedded.

GitHub uses plain token format without any prefix.

Args:

Returns:

  • Complete URL with credentials embedded

Raises:

  • ValueError: If token is not configured

get_client <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-github/prefect_github/credentials.py#L58" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>

python
get_client(self) -> HTTPEndpoint

Gets an authenticated GitHub GraphQL HTTPEndpoint client.

Returns:

  • An authenticated GitHub GraphQL HTTPEndpoint client.