通过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.