Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 925e7cd

Browse filesBrowse files
authored
chore: version of client is specified on one place (influxdata#265)
1 parent 0c1d1d9 commit 925e7cd
Copy full SHA for 925e7cd

File tree

6 files changed

+16
-9
lines changed
Filter options

6 files changed

+16
-9
lines changed

‎influxdb_client/__init__.py

Copy file name to clipboardExpand all lines: influxdb_client/__init__.py
+3-1Lines 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

Copy file name to clipboardExpand all lines: influxdb_client/api_client.py
+2-1Lines 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

Copy file name to clipboardExpand all lines: influxdb_client/configuration.py
+3-2Lines 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

Copy file name to clipboard
+3Lines 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.0dev0'

‎setup.py

Copy file name to clipboardExpand all lines: setup.py
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@
4040
NAME = "influxdb_client"
4141

4242
meta = {}
43-
with open(Path(__file__).parent / 'influxdb_client' / '__init__.py') as f:
44-
exec('\n'.join(l for l in f if l.startswith('__')), meta)
43+
with open(Path(__file__).parent / 'influxdb_client' / 'version.py') as f:
44+
exec('\n'.join(l for l in f if l.startswith('CLIENT_VERSION')), meta)
4545

4646
setup(
4747
name=NAME,
48-
version=meta['__version__'],
48+
version=meta['CLIENT_VERSION'],
4949
description="InfluxDB 2.0 Python client library",
5050
long_description=readme,
5151
url="https://github.com/influxdata/influxdb-client-python",

‎tests/test_WriteApiBatching.py

Copy file name to clipboardExpand all lines: tests/test_WriteApiBatching.py
+2-2Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.