Setting up Python example - influxdb_client.rest.ApiException: (401) Reason: Unauthorized

Hi I am new to InfluxDB. Using the install instructions at Install InfluxDB | InfluxDB OSS 2.5 Documentation and following the setting up example in Python, I got an influxdb_client.rest.ApiException: (401) error when trying to write data to the bucket.

...
influxdb_client.rest.ApiException: (401)
Reason: Unauthorized
HTTP response headers: HTTPHeaderDict({'Date': 'Wed, 14 Dec 2022 03:26:47 GMT', 'Content-Type': 'application/json; charset=utf-8', 'Content-Length': '55', 'Connection': 'keep-alive', 'trace-id': '298825b20470a9f7', 'trace-sampled': 'false', 'x-platform-error-code': 'unauthorized', 'Strict-Transport-Security': 'max-age=15724800; includeSubDomains', 'X-Influxdb-Request-ID': 'aa457554d4aa2ba4666cf6d24074825b', 'X-Influxdb-Build': 'Cloud'})
HTTP response body: {"code":"unauthorized","message":"unauthorized access"}

Any help to resolve this would be much appreciated.

Hi @wwwww,

thanks for using our client.

How do you set the authorization token to the client?

Regards