Skip to main content

A Python SDK for Masrobo RCS OPEN API

Project description

Open Python SDK

Open Python SDK is a lightweight Python client for the Boticz Open API.

Features

  • X-Token authentication using JWT tokens generated from app_id and app_key using JWT tokens generated from app_id and app_key
  • Unified HTTP client and error handling
  • IoT device APIs
    • Get latest device data
    • Send device command
    • Bind device
    • Update device settings

如何使用

安装

pip3 install boticz_rcs_sdk

Quick Start

from boticz_rcs_sdk import RobotController, TopicDeviceData, GetLatestDeviceDataRequest

client = RobotController(
    base_url="https://api.boticz.cn/open",
    app_id="your-app-id",
    app_key="your-app-key",
)

resp = client.IotDevice.get_latest_device_data(
    GetLatestDeviceDataRequest(
        product_name="demo_product",
        device_id="device001",
        topic_name=TopicDeviceData,
    )
)

print(resp)

Available APIs

Get latest device data

from masrobo_rcs_sdk import TopicScreenshot, GetLatestDeviceDataRequest

client.IotDevice.get_latest_device_data(
    GetLatestDeviceDataRequest(
        product_name="demo_product",
        device_id="device001",
        topic_name=TopicScreenshot,
    )
)

Send device command

from masrobo_rcs_sdk import TopicRemoteControl, SendDeviceCommandRequest

client.IotDevice.send_device_command(
    SendDeviceCommandRequest(
        command="reboot",
        parameter='{"delay":1}',
        device_id="device001",
        product_name="demo_product",
        topic_name=TopicRemoteControl,
    )
)

Bind device

from masrobo_rcs_sdk import BindDeviceRequest

client.IotDevice.bind_device(BindDeviceRequest(device_id="device001"))

Update device settings

from masrobo_rcs_sdk import DeviceSettingRequest

client.IotDevice.setting(
    DeviceSettingRequest(
        device_id="device001",
        settings='{"temperature":{"max_value":30,"min_value":10,"calibration":0},"humidity":{"max_value":80,"min_value":20,"calibration":0},"data_recording_interval":5,"reporting_interval":10,"alert_interval":15,"alert_battery":10}',
    )
)

Error Handling

from masrobo_rcs_sdk import APIError

try:
    client.IotDevice.get_latest_device_data(
        GetLatestDeviceDataRequest(
            product_name="demo_product",
            device_id="device001",
            topic_name=TopicDeviceData,
        )
    )
except APIError as err:
    print(err.status_code, err.code, err.message)

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

masrobo_rcs_sdk-0.1.0.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

masrobo_rcs_sdk-0.1.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file masrobo_rcs_sdk-0.1.0.tar.gz.

File metadata

  • Download URL: masrobo_rcs_sdk-0.1.0.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.4

File hashes

Hashes for masrobo_rcs_sdk-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1c0b856d752639a13b9311b7fa14dae06efe2690d9028112e77f68458e1214f1
MD5 7d262cd6eb95db2616c9dbf789a717cd
BLAKE2b-256 f978c450cc01addfaa5e539e131e71ee5207edb2f16f6b66d9b9d21b670e73c6

See more details on using hashes here.

File details

Details for the file masrobo_rcs_sdk-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for masrobo_rcs_sdk-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3da31300402754aa63cd42a49b0a3063a78c63e9c38244b681f2de3ce2e3655d
MD5 0106b1c89c3f2513f6cc9fef44f21f97
BLAKE2b-256 114bbad4ff1211b28c9d8389f42694162ee099ca19731ae1479a2305b0f0850f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page