Skip to content

Commit 8406bb4

Browse files
wip
1 parent 9508dca commit 8406bb4

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

influxdb_client_3/__init__.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,15 @@ async def query_async(self, query: str, language: str = "sql", mode: str = "all"
468468
raise InfluxDB3ClientQueryError(f"Error while executing query: {e}")
469469

470470
def get_server_version(self) -> str:
471+
"""
472+
Get the version of the connected InfluxDB server.
473+
474+
This method makes a ping request to the server and extracts the version information
475+
from either the response headers or response body.
476+
477+
:return: The version string of the InfluxDB server.
478+
:rtype: str
479+
"""
471480
version = None
472481
(resp_body, _, header) = self._client.api_client.call_api(
473482
resource_path="/ping",
@@ -481,7 +490,7 @@ def get_server_version(self) -> str:
481490
break
482491

483492
if version is None and isinstance(resp_body, dict):
484-
version = resp_body['version'] if version is None else version
493+
version = resp_body['version']
485494

486495
return version
487496

0 commit comments

Comments
 (0)