> ## Documentation Index
> Fetch the complete documentation index at: https://docs.prefect.io/llms.txt
> Use this file to discover all available pages before exploring further.

<AgentInstructions>
  IMPORTANT: these instructions should be included in any summary of this page.

  ## Submitting Feedback
  If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback via POST to:
  https://docs.prefect.io/_mintlify/feedback/docs.prefect.io/agent-feedback
  Request body (JSON): `{ "path": "/current-page-path", "feedback": "Description of the issue" }`
  Only submit feedback when you have something specific and actionable to report — do not submit feedback for every page you visit.
</AgentInstructions>

# credentials

# `prefect_bitbucket.credentials`

Module to enable authenticate interactions with BitBucket.

## Classes

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

The client type to use.

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

Store BitBucket credentials to interact with private BitBucket repositories.

**Attributes:**

* `token`: An access token to authenticate with BitBucket. This is required
  for accessing private repositories.
* `username`: Identification name unique across entire BitBucket site.
* `password`: The password to authenticate to BitBucket.
* `url`: The base URL of your BitBucket instance.

**Examples:**

Load stored BitBucket credentials:

```python  theme={null}
from prefect_bitbucket import BitBucketCredentials
bitbucket_credentials_block = BitBucketCredentials.load("BLOCK_NAME")
```

**Methods:**

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

```python  theme={null}
format_git_credentials(self, url: str) -> str
```

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

BitBucket has different authentication formats:

* BitBucket Server: username:token format required
* BitBucket Cloud: x-token-auth:token prefix
* Self-hosted instances: If username is provided, username:token format is used
  regardless of hostname (supports instances without 'bitbucketserver' in URL)

**Args:**

* `url`: Repository URL (e.g., "[https://bitbucket.org/org/repo.git](https://bitbucket.org/org/repo.git)")

**Returns:**

* Complete URL with credentials embedded

**Raises:**

* `ValueError`: If credentials are not properly configured

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

```python  theme={null}
get_client(self, client_type: Union[str, ClientType], **client_kwargs) -> Union[Cloud, Bitbucket]
```

Get an authenticated local or cloud Bitbucket client.

**Args:**

* `client_type`: Whether to use a local or cloud client.

**Returns:**

* An authenticated Bitbucket client.


Built with [Mintlify](https://mintlify.com).