ONEKEY API client
Project description
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.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
onekey_client-2.1.1.tar.gz
(23.0 kB
view hashes)
Built Distribution
Close
Hashes for onekey_client-2.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39fa8604e06aa4663a541748744f7649997169c66853caa41a16bee3b5aa02a6 |
|
MD5 | 30ec556494ba93eacf6d4e9a6e94d4a1 |
|
BLAKE2b-256 | 19a1fed9326f1bc02ffc0fb2064451ad410387dc31a977a95772b7ef0ab6d0b4 |