

The only parameter we need is "lang": "en"Ĭountry_codes = openapi.get("/v3.0/iot-03/all-countries", dict())st.json(city_info)
Evertried code code#
Understanding the Country and City Request API, first let us try to get country code list through the API. # Initialization of tuya openapiopenapi = TuyaOpenAPI(ENDPOINT, ACCESS_ID, ACCESS_KEY, AuthType.CUSTOM)# on printing you would get response and uid for other usecases print(nnect(USERNAME, PASSWORD)) Once those details are ready, it's time to connect TuyaOpenAPI

Next comes authorizing details (below details are available on your Overview Tab of Tuya Cloud ProjectĪCCESS_ID = "acbe*************123"ACCESS_KEY = "abcderf*************"API_ENDPOINT = ""USERNAME = # email address or phone numberPASSWORD = 'Job123'Ĭheck your endpoint is correct according to your region, We are also using streamlit for UI layouts.įrom tuya_connector import (TuyaOpenAPI)import streamlit as st

It's easy to test and try out APIs without any setups and installations,įirst, we have to import TuyaOpenAPI from Tuya Connecter that we installed before. Tuya also provide API explore where you can try out the API requests before moving on to code, Once these steps are complete you can move on to the code part. Then go to Users tab and add your email and password details that you will use to authorise with python APIs.Ĭheck the Overview tab for Access_ID and Access_Keys to be used with Python APIs. Its Cloud APIs makes it powerful enough to connect clients all over the globe.Īdd a cloud project and select your respective zone-based data centre.Īfter, the project is created - Go to the Service API tab and authorize Country and City Info API The platform provides developers with a one-stop IoT PaaS-level solution that contains hardware development tools, global cloud services, and smart business platform development, Tuyaoffering comprehensive ecosystem empowerment from technology to marketing channels to build the world’s leading IoT Cloud Platform. Tuya is a leading global IoT Cloud Platform that connects the intelligent needs of brands, OEMs, developers, and retail chains.
