Skip to content

Commit eb6557a

Browse files
committed
Use params option of Requests, urlencode is useless
1 parent e65f640 commit eb6557a

File tree

2 files changed

+14
-15
lines changed

2 files changed

+14
-15
lines changed

influxdb/client.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
"""
55
import json
66

7-
from six.moves.urllib.parse import urlencode
8-
97
import requests
108
session = requests.Session()
119

@@ -159,20 +157,22 @@ def query(self, query, time_precision='s', chunked=False):
159157
else:
160158
chunked_param = 'false'
161159

162-
encoded_query = urlencode({
163-
'q': query})
164-
165-
url_format = "{0}/db/{1}/series?{2}&u={3}&p={4}"
166-
url_format += "&time_precision={5}&chunked={6}"
160+
url = "{0}/db/{1}/series"
167161

168-
response = session.get(url_format.format(
162+
url.format(
169163
self._baseurl,
170-
self._database,
171-
encoded_query,
172-
self._username,
173-
self._password,
174-
time_precision,
175-
chunked_param))
164+
self._database
165+
)
166+
167+
params = {
168+
'u': self._username,
169+
'p': self._password,
170+
'q': query,
171+
'time_precision': time_precision,
172+
'chunked': chunked_param
173+
}
174+
175+
response = session.get(url, params=params)
176176

177177
if response.status_code == 200:
178178
return json.loads(response.content)

requirements.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
six
21
requests>=1.0.3

0 commit comments

Comments
 (0)