Skip to content

Commit 6ed3f0b

Browse files
committed
Merge pull request influxdata#18 from lra/hotfix
Fix query() so that it builds a valid URL.
2 parents 63036c6 + 6452d5e commit 6ed3f0b

File tree

3 files changed

+7
-9
lines changed

3 files changed

+7
-9
lines changed

examples/tutorial.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
from influxdb import InfluxDBClient
44

55

6-
def main(host=None, port=None):
6+
def main(host='localhost', port=8086):
77
user = 'root'
88
password = 'root'
99
dbname = 'example'

influxdb/client.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,8 @@ def query(self, query, time_precision='s', chunked=False):
157157
else:
158158
chunked_param = 'false'
159159

160-
url = "{0}/db/{1}/series"
161-
162-
url.format(
163-
self._baseurl,
164-
self._database
165-
)
160+
# Build the URL of the serie to query
161+
url = "{0}/db/{1}/series".format(self._baseurl, self._database)
166162

167163
params = {
168164
'u': self._username,

tests/influxdb/client_test.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,14 +160,16 @@ def test_get_database_list_fails(self):
160160

161161
def test_delete_series(self):
162162
with patch.object(session, 'delete') as mocked_delete:
163-
mocked_delete.return_value = _build_response_object(status_code=204)
163+
mocked_delete.return_value = _build_response_object(
164+
status_code=204)
164165
cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
165166
cli.delete_series('old_series')
166167

167168
@raises(Exception)
168169
def test_delete_series_fails(self):
169170
with patch.object(session, 'delete') as mocked_delete:
170-
mocked_delete.return_value = _build_response_object(status_code=401)
171+
mocked_delete.return_value = _build_response_object(
172+
status_code=401)
171173
cli = InfluxDBClient('host', 8086, 'username', 'password', 'db')
172174
cli.delete_series('old_series')
173175

0 commit comments

Comments
 (0)