72
loading...
This website collects cookies to deliver better user experience
Tuya Developer Account. Get it here -
https://developer.tuya.com/en/
TuyaOpenAPI. To install,
pip install tuya-iot-py-sdk
from tuya_connector import (
TuyaOpenAPI
)
import streamlit as st
ACCESS_ID = "acbe*************123"
ACCESS_KEY = "abcderf*************"
API_ENDPOINT = "https://openapi.tuyain.com"
USERNAME = '[email protected]' # email address or phone number
PASSWORD = 'Job123'
# Initialization of tuya openapi
openapi = TuyaOpenAPI(ENDPOINT, ACCESS_ID, ACCESS_KEY, AuthType.CUSTOM)
# on printing you would get response and uid for other usecases
print(openapi.connect(USERNAME, PASSWORD))
"lang": "en"
country_codes = openapi.get("/v3.0/iot-03/all-countries", dict({"lang": "en"}))
st.json(country_codes)
city_info = openapi.get("/v1.0/iot-03/cities/positions", dict({"lat": "27.1751", "lon": "78.0421",
}))
st.json(city_info)
city_name
province_name
parent_city_name
country_name