HomeboxClient¶
The HomeboxClient is the top-level entry point for the py-homebox library.
It manages authentication and exposes all resource-specific sub-clients as attributes.
HomeboxClient
¶
Top-level client for the Homebox REST API.
Provides direct access to authentication and top-level endpoints, and exposes namespaced sub-clients for every resource group (items, labels, locations, etc.).
Attributes:
| Name | Type | Description |
|---|---|---|
base_url |
Base URL of the Homebox API (e.g. |
|
token |
Bearer token used to authenticate requests, or |
|
headers |
HTTP headers sent with every request. |
|
actions |
Sub-client for bulk action endpoints. |
|
assets |
Sub-client for asset-ID lookup endpoints. |
|
groups |
Sub-client for group and statistics endpoints. |
|
items |
Sub-client for item CRUD and attachment endpoints. |
|
labels |
Sub-client for label endpoints. |
|
locations |
Sub-client for location endpoints. |
|
maintenance |
Sub-client for maintenance-log endpoints. |
|
notifiers |
Sub-client for notification-channel endpoints. |
|
users |
Sub-client for user account endpoints. |
|
reporting |
Sub-client for reporting / export endpoints. |
|
labelmaker |
Sub-client for printable label endpoints. |
|
products |
Sub-client for barcode/QR-code product endpoints. |
|
templates |
Sub-client for item template endpoints. |
Example
from homebox import HomeboxClient client = HomeboxClient(base_url="https://demo.homebox.software/api") client.login("admin@admin.com", "admin") items = client.items.query_all_items()
Source code in homebox/client.py
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 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | |
__init__
¶
Initialise the client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
base_url
|
Optional[str]
|
Base URL of the Homebox API. Falls back to the
|
None
|
token
|
Optional[str]
|
Pre-obtained Bearer token. Falls back to the
|
None
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in homebox/client.py
login
¶
login(username: str, password: str, stay_logged_in: bool = False, provider: Optional[str] = None) -> TokenResponse
Authenticate with username and password and store the resulting token.
After a successful login all subsequent requests made through this client automatically include the returned Bearer token.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
username
|
str
|
Account e-mail address. |
required |
password
|
str
|
Account password. |
required |
stay_logged_in
|
bool
|
When |
False
|
provider
|
Optional[str]
|
Optional OAuth provider identifier. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
TokenResponse |
TokenResponse
|
Contains the |
Raises:
| Type | Description |
|---|---|
HTTPError
|
If the credentials are rejected (HTTP 401) or any other server error occurs. |
Source code in homebox/client.py
currency
¶
Return the group's configured currency.
Returns:
| Name | Type | Description |
|---|---|---|
Currency |
Currency
|
Currency metadata including code, name, symbol, and decimal precision. |
application_info
¶
Return a summary of the running Homebox instance.
Includes build information, feature flags (registration, demo mode, label printing), and the latest available release version.
Returns:
| Name | Type | Description |
|---|---|---|
APISummary |
APISummary
|
Application status and build metadata. |