Skip to content

Commit 319f10c

Browse files
committed
Merge pull request influxdata#83 from jonashaag/refactor
Refactor: Better name (Thanks @jonashaag!)
2 parents 4f2bb5e + cddaf04 commit 319f10c

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

influxdb/client.py

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ def switch_user(self, username, password):
124124
self._password = password
125125

126126
def request(self, url, method='GET', params=None, data=None,
127-
status_code=200):
127+
expected_response_code=200):
128128
"""
129129
Make a http request to API
130130
"""
@@ -153,7 +153,7 @@ def request(self, url, method='GET', params=None, data=None,
153153
timeout=self._timeout
154154
)
155155

156-
if response.status_code == status_code:
156+
if response.status_code == expected_response_code:
157157
return response
158158
else:
159159
raise InfluxDBClientError(response.content, response.status_code)
@@ -231,7 +231,7 @@ def write_points_with_precision(self, data, time_precision='s'):
231231
method='POST',
232232
params=params,
233233
data=data,
234-
status_code=200
234+
expected_response_code=200
235235
)
236236

237237
return True
@@ -247,7 +247,7 @@ def delete_points(self, name):
247247
self.request(
248248
url=url,
249249
method='DELETE',
250-
status_code=204
250+
expected_response_code=204
251251
)
252252

253253
return True
@@ -319,7 +319,7 @@ def query(self, query, time_precision='s', chunked=False):
319319
url=url,
320320
method='GET',
321321
params=params,
322-
status_code=200
322+
expected_response_code=200
323323
)
324324

325325
return response.json()
@@ -350,7 +350,7 @@ def create_database(self, database):
350350
url=url,
351351
method='POST',
352352
data=data,
353-
status_code=201
353+
expected_response_code=201
354354
)
355355

356356
return True
@@ -370,7 +370,7 @@ def delete_database(self, database):
370370
self.request(
371371
url=url,
372372
method='DELETE',
373-
status_code=204
373+
expected_response_code=204
374374
)
375375

376376
return True
@@ -387,7 +387,7 @@ def get_database_list(self):
387387
response = self.request(
388388
url=url,
389389
method='GET',
390-
status_code=200
390+
expected_response_code=200
391391
)
392392

393393
return response.json()
@@ -410,7 +410,7 @@ def delete_series(self, series):
410410
self.request(
411411
url=url,
412412
method='DELETE',
413-
status_code=204
413+
expected_response_code=204
414414
)
415415

416416
return True
@@ -478,7 +478,7 @@ def get_list_cluster_admins(self):
478478
response = self.request(
479479
url="cluster_admins",
480480
method='GET',
481-
status_code=200
481+
expected_response_code=200
482482
)
483483

484484
return response.json()
@@ -496,7 +496,7 @@ def add_cluster_admin(self, new_username, new_password):
496496
url="cluster_admins",
497497
method='POST',
498498
data=data,
499-
status_code=200
499+
expected_response_code=200
500500
)
501501

502502
return True
@@ -515,7 +515,7 @@ def update_cluster_admin_password(self, username, new_password):
515515
url=url,
516516
method='POST',
517517
data=data,
518-
status_code=200
518+
expected_response_code=200
519519
)
520520

521521
return True
@@ -529,7 +529,7 @@ def delete_cluster_admin(self, username):
529529
self.request(
530530
url=url,
531531
method='DELETE',
532-
status_code=200
532+
expected_response_code=200
533533
)
534534

535535
return True
@@ -555,7 +555,7 @@ def alter_database_admin(self, username, is_admin):
555555
url=url,
556556
method='POST',
557557
data=data,
558-
status_code=200
558+
expected_response_code=200
559559
)
560560

561561
return True
@@ -627,7 +627,7 @@ def get_database_users(self):
627627
response = self.request(
628628
url=url,
629629
method='GET',
630-
status_code=200
630+
expected_response_code=200
631631
)
632632

633633
return response.json()
@@ -657,7 +657,7 @@ def add_database_user(self, new_username, new_password, permissions=None):
657657
url=url,
658658
method='POST',
659659
data=data,
660-
status_code=200
660+
expected_response_code=200
661661
)
662662

663663
return True
@@ -676,7 +676,7 @@ def update_database_user_password(self, username, new_password):
676676
url=url,
677677
method='POST',
678678
data=data,
679-
status_code=200
679+
expected_response_code=200
680680
)
681681

682682
if username == self._username:
@@ -693,7 +693,7 @@ def delete_database_user(self, username):
693693
self.request(
694694
url=url,
695695
method='DELETE',
696-
status_code=200
696+
expected_response_code=200
697697
)
698698

699699
return True

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy