提问人:leadvic 提问时间:11/14/2023 最后编辑:leadvic 更新时间:11/19/2023 访问量:27
涂鸦 python 脚本无法连接。错误 501
Tuya python script doesn't connect. Error 501
问:
当我尝试使用tuya_iot库连接到涂鸦 api 时,我收到一个什么也没说的一般错误。
我试过了这个:
from tuya_iot import TuyaOpenAPI, TUYA_LOGGER
import logging
TUYA_LOGGER.setLevel(logging.DEBUG)
# Cloud project authorization info
ACCESS_ID = 'mysuperID'
ACCESS_KEY = 'mysuperSecretKey'
# For more info, refer to: https://developer.tuya.com/en/docs/iot/api-request?id=Ka4a8uuo1j4t4
ENDPOINT = "https://openapi.tuyaus.com" # Western America Data Center
# Project configuration
USERNAME = '[email protected]'
PASSWORD = 'thePassword of Tuya'
# Initialization of tuya openapi
openapi = TuyaOpenAPI(ENDPOINT, ACCESS_ID, ACCESS_KEY)
openapi.connect(USERNAME, PASSWORD)
我得到了这个:
[2023-11-13 18:44:47,778] [tuya-openapi] Request: method = POST, url = https://openapi.tuyaus.com/v1.0/iot-01/associated-users/actions/authorized-login, params = None, body = {'username': '[email protected]', 'password': '***', 'country_code': '', 'schema': ''}, t = 1699911887778
[2023-11-13 18:44:48,694] [tuya-openapi] Response: {
"code": 501,
"msg": "request fail with unkown error",
"success": false,
"t": 1699911889502,
"tid": "debb0af0826d11ee8088063dea7c5c23"
}
但我希望能获得成功的联系。
答: 暂无答案
评论
TuyaOpenAPI(...)
openapi.connect(...)
openapi.connect(...)