Registry / aws / tuya-device-sharing-sdk

tuya-device-sharing-sdk

JSON →
library0.2.9pypypiunverified

A Python SDK for Tuya Open API that provides IoT capabilities for device sharing, user management, and IoT core operations. Current version: 0.2.9. Maintained by Tuya official, with monthly releases.

pip install tuya-device-sharing-sdk
INSTALL
IMPORT
SIG · TUYA-DEVICE-SHARIN
T
tuya-device-sharing-sdk
awspythonv0.2.9
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

TuyaOpenAPI
from tuya_sharing import TuyaOpenAPI
from tuya_connector import TuyaOpenAPI

Initialize TuyaOpenAPI with credentials from environment variables and test connection.

import os from tuya_connector import TuyaOpenAPI ACCESS_ID = os.environ.get('TUYA_ACCESS_ID', '') ACCESS_KEY = os.environ.get('TUYA_ACCESS_KEY', '') API_ENDPOINT = 'https://openapi.tuyaus.com' openapi = TuyaOpenAPI(API_ENDPOINT, ACCESS_ID, ACCESS_KEY) openapi.connect() print('Connected' if openapi.token else 'Connection failed')
Debug
Known issues
gotchaThe package provides a 'tuya_connector' module, not a top-level 'tuya_device_sharing_sdk' module. Import from tuya_connector.
fix
Use 'from tuya_connector import TuyaOpenAPI' instead of 'from tuya_device_sharing_sdk import ...'
affects: all
gotchaAPI endpoint must match the region of your Tuya IoT account. Common endpoints: https://openapi.tuyaus.com (US), https://openapi.tuyacn.com (China), https://openapi.tuyaeu.com (Europe).
fix
Ensure API_ENDPOINT is set to the correct regional endpoint.
affects: all
deprecatedThe older pattern of importing from 'tuya_device_sharing_sdk' directly is deprecated. Only import from 'tuya_connector' is supported in v0.2.x.
fix
Change imports to use 'from tuya_connector import ...'
affects: >=0.2.0
gotchaToken expiration is not automatically refreshed in the SDK. You must handle token refresh logic yourself or re-connect on 401 errors.
fix
Check token expiry and call openapi.connect() again if needed.
affects: all
Upgrade
Version history
0.2.9latest on PyPI · released Jan 12, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
34 hits · last 30 days
node
30
OpenAI (training)
2
Resources
tuya-device-sharing-sdk — pip install tuya-device-sharing-sdk · libregistry