Reference for hub_sdk/hub_client.py
Note
This file is available at https://github.com/ultralytics/hub-sdk/blob/main/hub_sdk/hub_client.py. If you spot a problem please help fix it by contributing a Pull Request 🛠️. Thank you 🙏!
hub_sdk.hub_client.HUBClient
Bases: Auth
A client class for interacting with a HUB service, extending authentication capabilities.
Attributes:
Name | Type | Description |
---|---|---|
authenticated | bool | Indicates whether the client is authenticated. |
api_key | str | The API key for authentication. |
id_token | str | The identity token for authentication. |
Parameters:
Name | Type | Description | Default |
---|---|---|---|
credentials | dict | A dictionary containing authentication credentials. If None, the client will attempt to retrieve the API key from the environment variable "HUB_API_KEY". | None |
Source code in hub_sdk/hub_client.py
dataset
Returns an instance of the Datasets class for interacting with datasets.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
dataset_id | str | The identifier of the dataset. If provided, returns an instance associated with the specified dataset_id. | None |
Returns:
Type | Description |
---|---|
Datasets | An instance of the Datasets class. |
Source code in hub_sdk/hub_client.py
dataset_list
Returns a DatasetList instance for interacting with a list of datasets.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page_size | int | The number of datasets per page. | 10 |
public | bool | Pass true to retrieve list of Public dataset list. | None |
Returns:
Type | Description |
---|---|
DatasetList | An instance of the DatasetList class. |
Source code in hub_sdk/hub_client.py
login
Logs in the client using provided authentication credentials.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
api_key | str | The API key for authentication. | None |
id_token | str | The identity token for authentication. | None |
email | str | User's email. | None |
password | str | User's password. | None |
Source code in hub_sdk/hub_client.py
model
Returns an instance of the Models class for interacting with models.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
model_id | str | The identifier of the model. If provided, returns an instance associated with the specified model_id. | None |
Returns:
Type | Description |
---|---|
Models | An instance of the Models class. |
Source code in hub_sdk/hub_client.py
model_list
Returns a ModelList instance for interacting with a list of models.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page_size | int | The number of models per page. | 10 |
public | bool | Pass true to retrieve list of Public models list. | None |
Returns:
Type | Description |
---|---|
ModelList | An instance of the ModelList class. |
Source code in hub_sdk/hub_client.py
project
Returns an instance of the Projects class for interacting with Projects.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
project_id | str | The identifier of the project. If provided, returns an instance associated with the specified project_id. | None |
Returns:
Type | Description |
---|---|
Projects | An instance of the Projects class. |
Source code in hub_sdk/hub_client.py
project_list
Returns a ProjectList instance for interacting with a list of projects.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
page_size | int | The number of projects per page. | 10 |
public | bool | Pass true to retrieve list of Public models list. | None |
Returns:
Type | Description |
---|---|
ProjectList | An instance of the ProjectList class. |
Source code in hub_sdk/hub_client.py
team
team_list
user
Returns an instance of the Users class for interacting with Projects.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
user_id | str | The identifier of the user. If provided, returns an instance associated with the specified user_id. | None |
Returns:
Type | Description |
---|---|
Users | An instance of the Projects class. |
Source code in hub_sdk/hub_client.py
hub_sdk.hub_client.require_authentication
A decorator function to ensure that the wrapped method can only be executed if the client is authenticated.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
func | callable | The method to be wrapped. | required |
Returns:
Type | Description |
---|---|
callable | The wrapped method. |