通過Python語言連接實例
更新時間 2024-07-04 11:23:21
最近更新時間: 2024-07-04 11:23:21
分享文章
本章節介紹了通過Python語言連接GeminiDB Influx實例的方法。
前提條件
已安裝InfluxDB的Python客戶端。
使用非SSL方式連接實例的示例代碼
from influxdb import InfluxDBClient
client = InfluxDBClient(host=IP, port=****, username=****, password=****, ssl=False)
client.get_list_database()
說明上述host,port,username,password請以實際值為準。
使用SSL方式連接實例的示例代碼
from influxdb import InfluxDBClient
client = InfluxDBClient(host=IP, port=****, username=****, password=****, ssl=True)
client.get_list_database()
說明
host,port,username,password請以實際值為準。
ssl的值必須設置為True。
如果不設置ssl,或者ssl設置為False,則會報如下錯誤:
InfluxDBClientError: 400: Client sent an HTTP request to an HTTPS server.