ONEKEY API Client
This is the official Python client for the ONEKEY public API.
Usage
First, you have to log in and select a tenant:
from onekey_client import Client
YOUR_API_URL = "https://demo.onekey.com/api"
client = Client(api_url=YOUR_API_URL)
client.login(EMAIL, PASSWORD)
tenant = client.get_tenant("Environment name")
client.use_tenant(tenant)
After you logged in and selected the tenant, you can query the GraphQL API
GET_ALL_FIRMWARES = """
query {
allFirmwares {
id
name
}
}
"""
res = client.query(GET_ALL_FIRMWARES)
print(res)
GET_PRODUCT_GROUPS = """
query {
allProductGroups {
id
name
}
}
"""
res = client.query(GET_PRODUCT_GROUPS)
default_product_group = next(pg for pg in res["allProductGroups"] if pg["name"] == "Default")
You can upload firmwares:
metadata = FirmwareMetadata(
name="myFirmware",
vendor_name="myVendor",
product_name="myProduct",
product_group_id=default_product_group["id"],
)
firmware_path = Path("/path/to/firmware.bin")
res = client.upload_firmware(metadata, firmware_path, enable_monitoring=True)
print(res)
Support
You can create a new issue in this repo or contact us at support@onekey.com.
Metadata
Release files for onekey-client 2.0.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| onekey_client-2.0.0.tar.gz | 19.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| onekey_client-2.0.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 38.5 kB
Release files / onekey_client-2.0.0.tar.gz
| Download URL | onekey_client-2.0.0.tar.gz |
|---|---|
| Size | 19.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8ac773f4d77a58ba53aaa61f25599886af07382568bad5d23132047f47acfc63
|
|
BLAKE2b-256 checksum How to use checksums |
869fa29a7539a920400735c6766e5819e4973676aab57d90831a99344f789418
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.13 CPython/3.10.4 Linux/5.13.0-1025-azure
|
Release files / onekey_client-2.0.0-py3-none-any.whl
| Download URL | onekey_client-2.0.0-py3-none-any.whl |
|---|---|
| Size | 19.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
605ac58535b08ddce5d97c3ca2d22eaca97f76130c206eb574a09d2d4ba29a49
|
|
BLAKE2b-256 checksum How to use checksums |
0ff9c6ea71225c99e3ffd13efb5b90136aff9c3d1dd9008fe9f620d669da0c1e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.1.13 CPython/3.10.4 Linux/5.13.0-1025-azure
|