Skip to main content

prefect_github.credentials

Credential classes used to perform authenticated interactions with GitHub

Classes

GitHubCredentials

Block used to manage GitHub authentication. Attributes:
  • token: the token to authenticate into GitHub.
Examples: Load stored GitHub credentials:
from prefect_github import GitHubCredentials
github_credentials_block = GitHubCredentials.load("BLOCK_NAME")
Methods:

format_git_credentials

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

get_client(self) -> HTTPEndpoint
Gets an authenticated GitHub GraphQL HTTPEndpoint client. Returns:
  • An authenticated GitHub GraphQL HTTPEndpoint client.