GitProvider API#
You can obtain a GetApi handle via Project.get_git_api. Once you have an API handle, you can use it to obtain GitProvider objects using the following methods:
set_provider #
set_provider(
provider: Literal["GitHub", "GitLab", "BitBucket"],
username: str,
token: str,
host: str = None,
)
Configure a Git provider.
import hopsworks
project = hopsworks.login()
git_api = project.get_git_api()
git_api.set_provider("GitHub", "my_user", "my_token", host="github.com")
| PARAMETER | DESCRIPTION |
|---|---|
provider | Name of the git provider. TYPE: |
username | Username for the git provider service. TYPE: |
token | Token to set for the git provider service. TYPE: |
host | Host for the git provider, e.g., TYPE: |
| RAISES | DESCRIPTION |
|---|---|
hopsworks.client.exceptions.RestAPIError | If the backend encounters an error when handling the request. |
get_provider #
get_provider(
provider: Literal["GitHub", "GitLab", "BitBucket"],
host: str = None,
) -> git_provider.GitProvider | None
Get the configured Git provider.
| PARAMETER | DESCRIPTION |
|---|---|
provider | Name of the git provider. TYPE: |
host | Optional host for the git provider, e.g., TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
git_provider.GitProvider | None | The git provider or |
| RAISES | DESCRIPTION |
|---|---|
hopsworks.client.exceptions.RestAPIError | If the backend encounters an error when handling the request. |
get_providers #
get_providers() -> list[git_provider.GitProvider]
Get the configured Git providers.
| RETURNS | DESCRIPTION |
|---|---|
list[git_provider.GitProvider] | List of git provider objects. |
| RAISES | DESCRIPTION |
|---|---|
hopsworks.client.exceptions.RestAPIError | If the backend encounters an error when handling the request. |
GitProvider #
host property #
host
Host of the provider, can be for example github.com for GitHub, gitlab.com for GitLab or bitbucket.org for BitBucket.
delete #
delete()
Remove the git provider configuration.
| RAISES | DESCRIPTION |
|---|---|
hopsworks.client.exceptions.RestAPIError | If the backend encounters an error when handling the request |