赞
踩
}
if name == “__main__”:
print(“onenet”)
# 发送GET请求
response = requests.get(url, params=params, headers=headers)
# 获取响应内容
data = response.json()
# 打印结果
#print(data)
datastreams = data[‘data’][‘datastreams’]
for stream in datastreams:
stream_id = stream['id']
datapoints = stream['datapoints']
value = datapoints[0]['value'] # Assuming there is only one datapoint per id
print(f"{stream\_id}: {value}")
### 使用post方法下发指令
import requests
url = “http://iot-api.heclouds.com/datapoint/synccmds”
headers = {
“Accept”: “application/json, text/plain, */*”,
“Content-Type”: “application/json”,
“Authorization”: “授权信息”
}
query_params = {
“product_id”: “产品ID”,
“device_name”: “
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。