GitProvider API#
Handle#
get_git_api#
Project.get_git_api()
Get the git repository api for the project.
Returns
GitApi
: The Git Api handle
Creation#
set_provider#
GitApi.set_provider(provider, username, token, host=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")
- provider
str
: Name of git provider. Valid values are "GitHub", "GitLab" and "BitBucket". - username
str
: Username for the git provider service - token
str
: Token to set for the git provider service - host
str
: host for the git provider e.g. github.com for GitHub, gitlab.com for GitLab, bitbucket.org for BitBucket
Raises
hopsworks.client.exceptions.RestAPIError
: If the backend encounters an error when handling the request
Retrieval#
get_provider#
GitApi.get_provider(provider, host=None)
Get the configured Git provider
Arguments
- provider
str
: Name of git provider. Valid values are "GitHub", "GitLab" and "BitBucket". - host
str
: Optional host for the git provider e.g. github.com for GitHub, gitlab.com for GitLab, bitbucket.org for BitBucket
Returns
GitProvider
: The git provider or None
if it does not exist.
Raises
hopsworks.client.exceptions.RestAPIError
: If the backend encounters an error when handling the request
get_providers#
GitApi.get_providers()
Get the configured Git providers
Returns
List[GitProvider]
: List of git provider objects
Raises
hopsworks.client.exceptions.RestAPIError
: If the backend encounters an error when handling the request
Properties#
git_provider#
Name of the provider, can be GitHub, GitLab or BitBucket
host#
Host of the provider, can be for example github.com for GitHub, gitlab.com for GitLab or bitbucket.org for BitBucket
username#
Username set for the provider
Methods#
delete#
GitProvider.delete()
Remove the git provider configuration.
Raises
hopsworks.client.exceptions.RestAPIError
: If the backend encounters an error when handling the request