InfluxDB2.0 python client token error

Hi There,

I am using latest version of influxDB but however i am facing with the token error. The token is a string value which i copied it from the influxDB UI. Any help to overcome this error would be appreciated.

from influxdb import InfluxDBClient
from datetime import datetime
bucket = "bucket-name"
org = "org-name"
client = InfluxDBClient("http://localhost:8086", token, org, bucket) 

print("InfluxDB injection process started.")
    for row in df.iterrows():
        influxJson = [
                        "time" : datetime.utcnow().isoformat() + "Z",
                        "tags": {
                        "fields": {
                            columns[0][0] : str(row[1][0]),
 client.write_points(influxJson) #writes data to influxdb
print("InfluxDB process DONE.")

output Error:

  File "", line 28, in startProcess
    client = InfluxDBClient("http://localhost:8086", token, org, bucket)
  File "/Users/peter/Library/Python/3.8/lib/python/site-packages/influxdb/", line 115, in __init__
    self.__port = int(port)
ValueError: invalid literal for int() with base 10: 'p5DH4KO_BwOP2-GORB4TpO4rTV0KQxrjWSRjH433vhX4pl0GS881hEulPMW4g8mFsvIG6MeEiJQXO65mhaWjsg=='

Thank You

You already asked a few days ago.
If you have InfluxDB 2.x, you are using the wrong client library!

Thank you for the reply. I have installed the influx db version 1.8 and start the influxd process, it is still picking up the latest version. But i have deleted the latest version of influxdb 2.x from local before installed influxdb 1.8

Your python code cannot work:

from influxdb import InfluxDBClient  # this is the V1 python client
client = InfluxDBClient("http://localhost:8086", token, org, bucket)  # but this is the API of the V2 python client
# therefore it fails with this 'port' error

You mixed code of V1 and V2 python client.