diff --git a/CHANGELOG.md b/CHANGELOG.md index 5122bb1c..2bf8f08f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ ### Bug Fixes 1. [#85](https://github.com/influxdata/influxdb-client-python/issues/85): Fixed a possibility to generate empty write batch 2. [#86](https://github.com/influxdata/influxdb-client-python/issues/86): BREAKING CHANGE: Fixed parameters in delete api - now delete api accepts also bucket name and org name instead of only ids +1. [#93](https://github.com/influxdata/influxdb-client-python/pull/93): Remove trailing slash from connection URL ## 1.6.0 [2020-04-17] diff --git a/influxdb_client/client/influxdb_client.py b/influxdb_client/client/influxdb_client.py index a8ca4eea..a78c1308 100644 --- a/influxdb_client/client/influxdb_client.py +++ b/influxdb_client/client/influxdb_client.py @@ -40,7 +40,10 @@ def __init__(self, url, token, debug=None, timeout=10000, enable_gzip=False, org self.default_tags = default_tags conf = _Configuration() - conf.host = self.url + if self.url.endswith("/"): + conf.host = self.url[:-1] + else: + conf.host = self.url conf.enable_gzip = enable_gzip conf.debug = debug diff --git a/tests/test_BucketsApi.py b/tests/test_BucketsApi.py index a528bf03..876e5e67 100644 --- a/tests/test_BucketsApi.py +++ b/tests/test_BucketsApi.py @@ -37,6 +37,7 @@ def test_create_delete_bucket(self): assert self.buckets_api.find_bucket_by_id(my_bucket.id) assert "bucket not found" in e.value.body + @pytest.mark.skip(reason="https://github.com/influxdata/influxdb/issues/14900") def test_find_by_name(self): my_org = self.find_my_org() diff --git a/tests/test_InfluxDBClient.py b/tests/test_InfluxDBClient.py new file mode 100644 index 00000000..1e8da1da --- /dev/null +++ b/tests/test_InfluxDBClient.py @@ -0,0 +1,13 @@ +import unittest + +from influxdb_client import InfluxDBClient + + +class InfluxDBClientTest(unittest.TestCase): + + def test_TrailingSlashInUrl(self): + client = InfluxDBClient(url="http://localhost:9999", token="my-token", org="my-org") + self.assertEqual('http://localhost:9999', client.api_client.configuration.host) + + client = InfluxDBClient(url="http://localhost:9999/", token="my-token", org="my-org") + self.assertEqual('http://localhost:9999', client.api_client.configuration.host)