Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: remove trailing slash from connection URL #93

Merged
merged 2 commits into from
May 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
5 changes: 4 additions & 1 deletion influxdb_client/client/influxdb_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions tests/test_BucketsApi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down
13 changes: 13 additions & 0 deletions tests/test_InfluxDBClient.py
Original file line number Diff line number Diff line change
@@ -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)