我可以解释一下如何在Python中使用请求发送此CURL:
curl -i -XPOST 'http://localhost:8086/write?db=mydb' --data-binary 'cpu_load_short,host=server01,region=us-west value=0.64 1434055562000000000'
我不知道如何将其解析为示例代码。非常感谢
答案 0 :(得分:1)
import requests
url_string = 'http://localhost:8086/write?db=mydb'
data_string = 'cpu_load_short,host=server01,region=us-west value=0.64 1434055562000000000'
r = requests.post(url_string, data=data_string)
答案 1 :(得分:0)
要通过Python3创建InfluxDB:
#!/usr/bin/env python3
import urllib.request as requests
url = "http://localhost:8086/query"
params = {
"q=CREATE DATABASE mydb"
}
r = requests.Request(url, data=params)