Repository: influxdata/influxdb-client-python

Issue:
Ping throwing exception when DEBUG is True
### Specifications

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


### Code sample to reproduce problem

```python

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`.

Comments:

Patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 2f2cb4d..6f11f45 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,6 +5,7 @@
 
 ### Bug Fixes
 1. [#562](https://github.com/influxdata/influxdb-client-python/pull/562): Use `ThreadPoolScheduler` for `WriteApi`'s batch subject instead of `TimeoutScheduler` to prevent creating unnecessary threads repeatedly
+1. [#631](https://github.com/influxdata/influxdb-client-python/pull/631): Logging HTTP requests without query parameters
 
 ## 1.39.0 [2023-12-05]
 
diff --git a/influxdb_client/_sync/rest.py b/influxdb_client/_sync/rest.py
index 2d80de1..eadbf06 100644
--- a/influxdb_client/_sync/rest.py
+++ b/influxdb_client/_sync/rest.py
@@ -170,7 +170,7 @@ class RESTClientObject(object):
             headers['Content-Type'] = 'application/json'
 
         if self.configuration.debug:
-            _BaseRESTClient.log_request(method, f"{url}?{urlencode(query_params)}")
+            _BaseRESTClient.log_request(method, f"{url}{'' if query_params is None else '?' + urlencode(query_params)}")
             _BaseRESTClient.log_headers(headers, '>>>')
             _BaseRESTClient.log_body(body, '>>>')
 


Test patch:
diff --git a/tests/test_InfluxDBClient.py b/tests/test_InfluxDBClient.py
index ca37291..c2f9b0a 100644
--- a/tests/test_InfluxDBClient.py
+++ b/tests/test_InfluxDBClient.py
@@ -415,6 +415,18 @@ class InfluxDBClientTestMock(unittest.TestCase):
         logger = logging.getLogger('influxdb_client.client.http')
         self.assertEqual(2, len(logger.handlers))
 
+    def test_debug_request_without_query_parameters(self):
+        httpretty.register_uri(httpretty.GET, uri="http://localhost/ping", status=200, body="")
+        self.influxdb_client = InfluxDBClient("http://localhost", "my-token", debug=True)
+
+        log_stream = StringIO()
+        logger = logging.getLogger("influxdb_client.client.http")
+        logger.addHandler(logging.StreamHandler(log_stream))
+
+        self.influxdb_client.api_client.call_api('/ping', 'GET')
+
+        self.assertIn("'GET http://localhost/ping'", log_stream.getvalue())
+
 
 class ServerWithSelfSingedSSL(http.server.SimpleHTTPRequestHandler):
     def _set_headers(self, response: bytes):