Skip to content

Ping throwing exception when DEBUG is True #630

Closed
@rusnackor

Description

@rusnackor

Specifications

  • Client Version: influxdb-client-python/1.36.0
  • InfluxDB Version: v2.7.1
  • Platform: alpine-linux

Code sample to reproduce problem

from influxdb_client import InfluxDBClient

client = InfluxDBClient(url='http://localhost:8086', token="MyToken==", org='myorganization', timeout=30000, debug=True)
client.api_client.call_api('/ping', 'GET')

Expected behavior

I am using connection check method from official example: examples/connection_check.py to see if my DB is connected.

This is working fine, when I have debug=False, it will simply pass.

Actual behavior

However, when I do debug=True I will get this exception:

python3 examples/debug_test.py 
Traceback (most recent call last):
  File "/usr/lib/python3.10/urllib/parse.py", line 947, in urlencode
    if len(query) and not isinstance(query[0], tuple):
TypeError: object of type 'NoneType' has no len()

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/examples/debug_test.py", line 5, in <module>
    client.api_client.call_api('/ping', 'GET')
  File "/usr/lib/python3.10/site-packages/influxdb_client/_sync/api_client.py", line 343, in call_api
    return self.__call_api(resource_path, method,
  File "/usr/lib/python3.10/site-packages/influxdb_client/_sync/api_client.py", line 173, in __call_api
    response_data = self.request(
  File "/usr/lib/python3.10/site-packages/influxdb_client/_sync/api_client.py", line 365, in request
    return self.rest_client.GET(url,
  File "/usr/lib/python3.10/site-packages/influxdb_client/_sync/rest.py", line 268, in GET
    return self.request("GET", url,
  File "/usr/lib/python3.10/site-packages/influxdb_client/_sync/rest.py", line 173, in request
    _BaseRESTClient.log_request(method, f"{url}?{urlencode(query_params)}")
  File "/usr/lib/python3.10/urllib/parse.py", line 955, in urlencode
    raise TypeError("not a valid non-string sequence "
  File "/usr/lib/python3.10/urllib/parse.py", line 947, in urlencode
    if len(query) and not isinstance(query[0], tuple):
TypeError: not a valid non-string sequence or mapping object

Additional info

I was trying different formats of debug variable (string, etc) but none seems to work, boolean is only working option, it seems like there is something in urllib.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions