28 lines
656 B
Python
28 lines
656 B
Python
# 数据库插入类型
|
|
import base64
|
|
|
|
rfid_type = ["TEXT", "TEXT", "FLOAT"]
|
|
air_type = ["TEXT", "FLOAT", "FLOAT"]
|
|
else_type = ["TEXT", "FLOAT"]
|
|
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
|
|
}
|