Skip to content

Commit df06325

Browse files
committed
chore: version of client is specified on one place
1 parent 0c1d1d9 commit df06325

File tree

5 files changed

+13
-6
lines changed

5 files changed

+13
-6
lines changed

influxdb_client/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -298,4 +298,6 @@
298298
from influxdb_client.client.influxdb_client import InfluxDBClient
299299
from influxdb_client.client.write.point import Point
300300

301-
__version__ = '1.19.0dev'
301+
from influxdb_client.version import CLIENT_VERSION
302+
303+
__version__ = CLIENT_VERSION

influxdb_client/api_client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ def __init__(self, configuration=None, header_name=None, header_value=None,
7676
self.default_headers[header_name] = header_value
7777
self.cookie = cookie
7878
# Set default User-Agent.
79-
self.user_agent = 'influxdb-client-python/1.19.0dev'
79+
from influxdb_client import CLIENT_VERSION
80+
self.user_agent = f'influxdb-client-python/{CLIENT_VERSION}'
8081

8182
def __del__(self):
8283
"""Dispose pools."""

influxdb_client/configuration.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,12 +242,13 @@ def to_debug_report(self):
242242
243243
:return: The report for debugging.
244244
"""
245+
from influxdb_client import CLIENT_VERSION
245246
return "Python SDK Debug Report:\n"\
246247
"OS: {env}\n"\
247248
"Python Version: {pyversion}\n"\
248249
"Version of the API: 2.0.0\n"\
249-
"SDK Package Version: 1.19.0dev".\
250-
format(env=sys.platform, pyversion=sys.version)
250+
"SDK Package Version: {client_version}".\
251+
format(env=sys.platform, pyversion=sys.version, client_version=CLIENT_VERSION)
251252

252253
def update_request_header_params(self, path: str, params: dict):
253254
"""Update header params based on custom settings.

influxdb_client/version.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
"""Version of the Client that is used in User-Agent header."""
2+
3+
CLIENT_VERSION = '1.19.0dev'

tests/test_WriteApiBatching.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
from rx import operators as ops
1111

1212
import influxdb_client
13-
from influxdb_client import WritePrecision, InfluxDBClient
13+
from influxdb_client import WritePrecision, InfluxDBClient, CLIENT_VERSION
1414
from influxdb_client.client.write.point import Point
1515
from influxdb_client.client.write_api import WriteOptions, WriteApi, PointSettings
1616

@@ -459,7 +459,7 @@ def test_user_agent_header(self):
459459

460460
requests = httpretty.httpretty.latest_requests
461461
self.assertEqual(1, len(requests))
462-
self.assertEqual(f'influxdb-client-python/{influxdb_client.__version__}', requests[0].headers['User-Agent'])
462+
self.assertEqual(f'influxdb-client-python/{CLIENT_VERSION}', requests[0].headers['User-Agent'])
463463

464464
def test_to_low_flush_interval(self):
465465

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy