docs/integrations/prefect-gitlab/api-ref/prefect_gitlab-credentials.mdx
prefect_gitlab.credentialsModule used to enable authenticated interactions with GitLab
GitLabCredentials <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gitlab/prefect_gitlab/credentials.py#L12" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>Store a GitLab personal access token to interact with private GitLab repositories.
Attributes:
token: The personal access token to authenticate with GitLab.url: URL to self-hosted GitLab instances.Examples:
Load stored GitLab credentials:
from prefect_gitlab import GitLabCredentials
gitlab_credentials_block = GitLabCredentials.load("BLOCK_NAME")
Methods:
format_git_credentials <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gitlab/prefect_gitlab/credentials.py#L41" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>format_git_credentials(self, url: str) -> str
Format and return the full git URL with GitLab credentials embedded.
Handles both personal access tokens and deploy tokens correctly:
Args:
url: Repository URL (e.g., "https://gitlab.com/org/repo.git")Returns:
Raises:
ValueError: If token is not configuredget_client <sup><a href="https://github.com/PrefectHQ/prefect/blob/main/src/integrations/prefect-gitlab/prefect_gitlab/credentials.py#L81" target="_blank"><Icon icon="github" style="width: 14px; height: 14px;" /></a></sup>get_client(self) -> Gitlab
Gets an authenticated GitLab client.
Returns: