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. |
Source code in hub_sdk/hub_client.py
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 |
|
__init__(credentials=None)
Initializes the HUBClient instance.
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(dataset_id=None)
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(page_size=10, public=None)
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(api_key=None, id_token=None, email=None, password=None)
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(model_id=None)
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(page_size=10, public=None)
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(project_id=None)
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(page_size=10, public=None)
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(arg)
team_list(page_size=None, public=None)
user(user_id=None)
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(func)
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. |