# tuya-connector-python
![PyPI](https://img.shields.io/pypi/v/tuya-connector-python)
![PyPI - Downloads](https://img.shields.io/pypi/dm/tuya-connector-python)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/tuya-connector-python)
The `tuya-connector-python` SDK is designed to support openAPIs and Pulsar messages provided by Tuya. Before using this SDK, you can see [Quick Start](https://developer.tuya.com/en/docs/iot/quick-start1?id=K95ztz9u9t89n) on the Tuya Developer website to learn more about Cloud Development Platform.
## Install
`pip3 install tuya-connector-python`
## Get started
1. [Sign up](https://auth.tuya.com/register?from=https%3A%2F%2Fiot.tuya.com%2F) for Tuya developer account.
2. [Create a cloud project](https://iot.tuya.com/cloud/). See the [tutorial](https://developer.tuya.com/en/docs/iot/device-control-practice?id=Kat1jdeul4uf8) for how to get the authorization key and other necessary parameters.
3. A quick example is as follows:
``` python
from tuya_connector import (
TuyaOpenAPI,
TuyaOpenPulsar,
TuyaCloudPulsarTopic,
)
ACCESS_ID = "your-access-id"
ACCESS_KEY = "your-access-key"
API_ENDPOINT = "https://openapi.tuyacn.com"
MQ_ENDPOINT = "wss://mqe.tuyacn.com:8285/"
# Init OpenAPI and connect
openapi = TuyaOpenAPI(API_ENDPOINT, ACCESS_ID, ACCESS_KEY)
openapi.connect()
# Call any API from Tuya
response = openapi.get("/v1.0/statistics-datas-survey", dict())
# Init Message Queue
open_pulsar = TuyaOpenPulsar(
ACCESS_ID, ACCESS_KEY, MQ_ENDPOINT, TuyaCloudPulsarTopic.PROD
)
# Add Message Queue listener
open_pulsar.add_message_listener(lambda msg: print(f"---\nexample receive: {msg}"))
# Start Message Queue
open_pulsar.start()
input()
# Stop Message Queue
open_pulsar.stop()
```
## OpenAPI reference
Tuya opens up a variety of APIs covering scenarios such as device pairing, asset management, and device control. You can call APIs according to [API reference](https://developer.tuya.com/en/docs/cloud/?_source=github) to create IoT applications.
## Feedback
If you have any questions, please provide feedback via **Github Issue** or [Technical Ticket](https://service.console.tuya.com/).
## License
The `tuya-connector-python` SDK is available under the MIT license. For more information, see the [LICENSE](./LICENSE) file.
Raw data
{
"_id": null,
"home_page": "https://github.com/tuya/tuya-connector-python",
"name": "tuya-connector-python",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.0",
"maintainer_email": "",
"keywords": "tuya iot cloud sdk python",
"author": "Tuya Inc.",
"author_email": "developer@tuya.com",
"download_url": "https://files.pythonhosted.org/packages/3e/3c/d3d750fc81a87aaec9082b13fe270e5e6ff9b3432791989042d46b251447/tuya-connector-python-0.1.2.tar.gz",
"platform": "",
"description": "# tuya-connector-python\n\n![PyPI](https://img.shields.io/pypi/v/tuya-connector-python)\n\n![PyPI - Downloads](https://img.shields.io/pypi/dm/tuya-connector-python)\n\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/tuya-connector-python)\n\nThe `tuya-connector-python` SDK is designed to support openAPIs and Pulsar messages provided by Tuya. Before using this SDK, you can see [Quick Start](https://developer.tuya.com/en/docs/iot/quick-start1?id=K95ztz9u9t89n) on the Tuya Developer website to learn more about Cloud Development Platform.\n\n## Install\n\n`pip3 install tuya-connector-python`\n\n## Get started\n\n1. [Sign up](https://auth.tuya.com/register?from=https%3A%2F%2Fiot.tuya.com%2F) for Tuya developer account.\n\n2. [Create a cloud project](https://iot.tuya.com/cloud/). See the [tutorial](https://developer.tuya.com/en/docs/iot/device-control-practice?id=Kat1jdeul4uf8) for how to get the authorization key and other necessary parameters.\n\n3. A quick example is as follows:\n\n ``` python\n from tuya_connector import (\n \tTuyaOpenAPI,\n \tTuyaOpenPulsar,\n \tTuyaCloudPulsarTopic,\n )\n\n ACCESS_ID = \"your-access-id\"\n ACCESS_KEY = \"your-access-key\"\n API_ENDPOINT = \"https://openapi.tuyacn.com\"\n MQ_ENDPOINT = \"wss://mqe.tuyacn.com:8285/\"\n\n # Init OpenAPI and connect\n openapi = TuyaOpenAPI(API_ENDPOINT, ACCESS_ID, ACCESS_KEY)\n openapi.connect()\n\n # Call any API from Tuya\n response = openapi.get(\"/v1.0/statistics-datas-survey\", dict())\n\n # Init Message Queue\n open_pulsar = TuyaOpenPulsar(\n \tACCESS_ID, ACCESS_KEY, MQ_ENDPOINT, TuyaCloudPulsarTopic.PROD\n )\n # Add Message Queue listener\n open_pulsar.add_message_listener(lambda msg: print(f\"---\\nexample receive: {msg}\"))\n\n # Start Message Queue\n open_pulsar.start()\n\n input()\n # Stop Message Queue\n open_pulsar.stop()\n ```\n\n## OpenAPI reference\n\nTuya opens up a variety of APIs covering scenarios such as device pairing, asset management, and device control. You can call APIs according to [API reference](https://developer.tuya.com/en/docs/cloud/?_source=github) to create IoT applications.\n\n## Feedback\n\nIf you have any questions, please provide feedback via **Github Issue** or [Technical Ticket](https://service.console.tuya.com/).\n\n## License\n\nThe `tuya-connector-python` SDK is available under the MIT license. For more information, see the [LICENSE](./LICENSE) file.\n\n\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "The `tuya-connector-python` SDK is desinged to support open APIs and Pulsar Messages provided by Tuya.",
"version": "0.1.2",
"project_urls": {
"Bug Tracker": "https://github.com/tuya/tuya-connector-python/issues",
"Changes": "https://github.com/tuya/tuya-connector-python/wiki/Tuya-Connector-Python-Release-Notes",
"Homepage": "https://github.com/tuya/tuya-connector-python"
},
"split_keywords": [
"tuya",
"iot",
"cloud",
"sdk",
"python"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6bf927a340f4472f6ada8da4ef30178cd32a55775ce6ada55ca4aa901652477d",
"md5": "c69450b29e33a6489e97e0c5cb6a0739",
"sha256": "42cde44cf9af86d187f89b2f0c121a1104a0c7b7ca16bc46bbc6b470d299afdf"
},
"downloads": -1,
"filename": "tuya_connector_python-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "c69450b29e33a6489e97e0c5cb6a0739",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.0",
"size": 9918,
"upload_time": "2021-11-08T11:12:44",
"upload_time_iso_8601": "2021-11-08T11:12:44.604639Z",
"url": "https://files.pythonhosted.org/packages/6b/f9/27a340f4472f6ada8da4ef30178cd32a55775ce6ada55ca4aa901652477d/tuya_connector_python-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "3e3cd3d750fc81a87aaec9082b13fe270e5e6ff9b3432791989042d46b251447",
"md5": "1cbdbd5ef504e1f804db954fe7e3384b",
"sha256": "84a8fa9b22d839e8ff0c3a45b36df6194b3dfb1b2dd31b9203eb7f94e3303d7e"
},
"downloads": -1,
"filename": "tuya-connector-python-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "1cbdbd5ef504e1f804db954fe7e3384b",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.0",
"size": 9091,
"upload_time": "2021-11-08T11:12:46",
"upload_time_iso_8601": "2021-11-08T11:12:46.476055Z",
"url": "https://files.pythonhosted.org/packages/3e/3c/d3d750fc81a87aaec9082b13fe270e5e6ff9b3432791989042d46b251447/tuya-connector-python-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2021-11-08 11:12:46",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "tuya",
"github_project": "tuya-connector-python",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [],
"lcname": "tuya-connector-python"
}