xumu_iotdb/config.py

45 lines
979 B
Python
Raw Normal View History

2024-01-24 15:32:58 +08:00
# 数据库插入类型
import base64
2024-01-24 16:27:34 +08:00
rfid_type = ["TEXT", "TEXT", "FLOAT", "INT32"]
air_type = ["TEXT", "FLOAT", "FLOAT", "INT32"]
else_type = ["TEXT", "FLOAT", "INT32"]
2024-01-24 15:32:58 +08:00
dataTypes = {
0: rfid_type,
1: air_type,
2: else_type,
3: else_type,
4: else_type,
5: else_type,
}
baseHost = "https://iot.lihaink.cn/iotdb_restapi"
# 注意这里前面不能加/
insertUri = "rest/v2/insertRecords"
queryUri = "rest/v2/query"
# 鉴权
username = 'root'
password = 'root'
code = (username + ":" + password).encode("utf-8")
token = base64.encodebytes(code).decode("utf-8").strip()
headers = {
'ContentType': 'application/json',
'Authorization': "Basic " + token
}
2024-01-24 16:27:34 +08:00
# RFID
send1 = {
"m": ["cid", "r", "v", "t"],
"v": ["abcd", "rfid", 10.62, 0],
"l": 63
}
# 空气
send2 = {
"m": ["cid", "at", "ah", "t"],
"v": ["test2", 10.62, 50.22, 1],
"l": 65
}
# 普通
send3 = {
"m": ["cid", "v", "t"],
"v": ["test1", 10.62, 2],
"l": 50
}