Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ping throwing exception when DEBUG is True #630

Closed
rusnackor opened this issue Jan 15, 2024 · 1 comment · Fixed by #631
Closed

Ping throwing exception when DEBUG is True #630

rusnackor opened this issue Jan 15, 2024 · 1 comment · Fixed by #631
Assignees
Labels
bug Something isn't working
Milestone

Comments

@rusnackor
Copy link

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.

@rusnackor rusnackor added the bug Something isn't working label Jan 15, 2024
@bednar
Copy link
Contributor

bednar commented Jan 17, 2024

Hi @rusnackor,

thanks for using our client.

I've prepared PR #631. If you would like to use dev version of client then install client via:

pip install git+https://github.com/influxdata/influxdb-client-python.git@logging-requests-without-query-parameters

Best Regards

@bednar bednar self-assigned this Jan 17, 2024
@bednar bednar added this to the 1.40.0 milestone Jan 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants