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-Tokenauthentication 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
- Add device
- Bind device
- Update device settings
如何使用
安装
pip3 install masrobo_rcs_sdk
Quick Start
from masrobo_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"))
Add device
from masrobo_rcs_sdk import AddDeviceRequest
result = client.IotDevice.add_device(
AddDeviceRequest(
project_name="demo_product",
device_id="device001",
)
)
print(result.qrcode_url)
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
Release history Release notifications | RSS feed
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.2.2.tar.gz
(13.4 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file masrobo_rcs_sdk-0.2.2.tar.gz.
File metadata
- Download URL: masrobo_rcs_sdk-0.2.2.tar.gz
- Upload date:
- Size: 13.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b04c0597a3d71e4d962b117382823d83d39b8e8736f23a352f7d73bcaddbbbdd
|
|
| MD5 |
f7a70b73f23efd21f3fc82d47b27c8cc
|
|
| BLAKE2b-256 |
f4f350b87aac692fdfeef2e3251f8ae502d66171bde8178b5abd88bab46ae5c3
|
File details
Details for the file masrobo_rcs_sdk-0.2.2-py3-none-any.whl.
File metadata
- Download URL: masrobo_rcs_sdk-0.2.2-py3-none-any.whl
- Upload date:
- Size: 8.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bba97200c6be03443f0a90b8e6be8d0cfa146a4e2b218568abcaddaca30969d2
|
|
| MD5 |
f2ce2ae6ce84b433773dd72f7c2cb228
|
|
| BLAKE2b-256 |
c22302cce1611ab960a011142a6e9fb97e6ba4a9fdde52f24f6fdb7e1b689b0f
|