Updated on 2023-11-21 GMT+08:00

Connecting to an Instance Using Python

This section describes how to connect to a GeminiDB Influx instance using the Python programming language.

Prerequisites

The Python client of InfluxDB has been installed.

Example Code for Accessing an Instance Using a Non-SSL Connection

from influxdb import InfluxDBClient
 
client = InfluxDBClient(host=IP, port=****, username=****, password=****, ssl=False) 
client.get_list_database()

Replace host, port, username, and password with the actual values.

Example Code for Accessing an Instance Using an SSL Connection

from influxdb import InfluxDBClient

client = InfluxDBClient(host=IP, port=****, username=****, password=****, ssl=True) 
client.get_list_database()
  • Replace host, port, username, and password with the actual values.
  • The value of ssl must be True.
  • If SSL is not set or is set to False, the following error information is displayed:

    InfluxDBClientError: 400: Client sent an HTTP request to an HTTPS server.