From f725c01778726688d5fbcb43dd4a56d6f15c9b0d Mon Sep 17 00:00:00 2001 From: Vitaly Chait <vitalyhait94@gmail.com> Date: Tue, 17 Sep 2024 02:18:49 +0300 Subject: [PATCH 1/5] Add url object type validation --- influxdb_client/client/_base.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/influxdb_client/client/_base.py b/influxdb_client/client/_base.py index 8dcf75e9..b45f2ad8 100644 --- a/influxdb_client/client/_base.py +++ b/influxdb_client/client/_base.py @@ -53,6 +53,9 @@ def __init__(self, url, token, debug=None, timeout=10_000, enable_gzip=False, or self.default_tags = default_tags self.conf = _Configuration() + + if not isinstance(self.url, str): + raise ValueError('"url" attribute is not str instance') if self.url.endswith("/"): self.conf.host = self.url[:-1] else: From bb8c391ca4ddd77840ff6943d845a37c477f6f00 Mon Sep 17 00:00:00 2001 From: Vitaly Chait <vitalyhait94@gmail.com> Date: Tue, 17 Sep 2024 02:22:57 +0300 Subject: [PATCH 2/5] Remove newline to align with requests --- influxdb_client/client/_base.py | 1 - 1 file changed, 1 deletion(-) diff --git a/influxdb_client/client/_base.py b/influxdb_client/client/_base.py index b45f2ad8..d4f17901 100644 --- a/influxdb_client/client/_base.py +++ b/influxdb_client/client/_base.py @@ -53,7 +53,6 @@ def __init__(self, url, token, debug=None, timeout=10_000, enable_gzip=False, or self.default_tags = default_tags self.conf = _Configuration() - if not isinstance(self.url, str): raise ValueError('"url" attribute is not str instance') if self.url.endswith("/"): From f4f3cec872bd9399277ee12985f048187d223a43 Mon Sep 17 00:00:00 2001 From: Vitaly Chait <vitalyhait94@gmail.com> Date: Tue, 17 Sep 2024 11:54:07 +0300 Subject: [PATCH 3/5] Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ebaccef3..36f2cd57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Bug Fixes 1. [#667](https://github.com/influxdata/influxdb-client-python/pull/667): Missing `py.typed` in distribution package +2. [#670](https://github.com/influxdata/influxdb-client-python/pull/670): Adding type validation to url attribute in client object ### Examples: 1. [#664](https://github.com/influxdata/influxdb-client-python/pull/664/): Multiprocessing example uses new source of data From 3a1b4d4c0f028cfc4327a99b139c0e06d9daecef Mon Sep 17 00:00:00 2001 From: Vitaly Chait <vitalyhait94@gmail.com> Date: Tue, 17 Sep 2024 02:18:49 +0300 Subject: [PATCH 4/5] fix: Add url object type validation Remove newline to align with requests --- influxdb_client/client/_base.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/influxdb_client/client/_base.py b/influxdb_client/client/_base.py index 8dcf75e9..d4f17901 100644 --- a/influxdb_client/client/_base.py +++ b/influxdb_client/client/_base.py @@ -53,6 +53,8 @@ def __init__(self, url, token, debug=None, timeout=10_000, enable_gzip=False, or self.default_tags = default_tags self.conf = _Configuration() + if not isinstance(self.url, str): + raise ValueError('"url" attribute is not str instance') if self.url.endswith("/"): self.conf.host = self.url[:-1] else: From a5fda627153edca0582c4fb02abcc8e16d3e9c37 Mon Sep 17 00:00:00 2001 From: Vitaly Chait <vitalyhait94@gmail.com> Date: Tue, 17 Sep 2024 11:54:07 +0300 Subject: [PATCH 5/5] docs: Update CHANGELOG.md --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ebaccef3..36f2cd57 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,7 @@ ### Bug Fixes 1. [#667](https://github.com/influxdata/influxdb-client-python/pull/667): Missing `py.typed` in distribution package +2. [#670](https://github.com/influxdata/influxdb-client-python/pull/670): Adding type validation to url attribute in client object ### Examples: 1. [#664](https://github.com/influxdata/influxdb-client-python/pull/664/): Multiprocessing example uses new source of data