Skip to content

Commit d0dba10

Browse files
committed
remove admin_sig_version in the admin client and only use sig_version
1 parent 2adfc0b commit d0dba10

3 files changed

Lines changed: 10 additions & 33 deletions

File tree

duo_client/admin.py

Lines changed: 3 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -216,40 +216,16 @@
216216

217217
class Admin(client.Client):
218218
account_id = None
219-
admin_sig_version = 5
219+
sig_version = 5
220220

221-
def api_call(self, method, path, params, sig_version=admin_sig_version):
221+
def api_call(self, method, path, params, sig_version=sig_version):
222222
if self.account_id is not None:
223223
params['account_id'] = self.account_id
224-
return super(Admin, self).api_call(
225-
method,
226-
path,
227-
params,
228-
sig_version=sig_version
229-
)
230224

231-
def json_api_call(self, method, path, params, sig_version=admin_sig_version):
232-
return super(Admin, self).json_api_call(
233-
method,
234-
path,
235-
params,
236-
sig_version=sig_version
237-
)
238-
239-
def json_paging_api_call(self, method, path, params, sig_version=admin_sig_version):
240-
return super(Admin, self).json_paging_api_call(
241-
method,
242-
path,
243-
params,
244-
sig_version=sig_version
245-
)
246-
247-
def json_cursor_api_call(self, method, path, params, get_records_func, sig_version=admin_sig_version):
248-
return super(Admin, self).json_cursor_api_call(
225+
return super(Admin, self).api_call(
249226
method,
250227
path,
251228
params,
252-
get_records_func,
253229
sig_version=sig_version
254230
)
255231

duo_client/client.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -462,16 +462,16 @@ def normalize_paging_args(self, limit=None, offset=0):
462462

463463
return (limit, offset)
464464

465-
def json_api_call(self, method, path, params, sig_version=None):
465+
def json_api_call(self, method, path, params):
466466
"""
467467
Call a Duo API method which is expected to return a JSON body
468468
with a 200 status. Return the response data structure or raise
469469
RuntimeError.
470470
"""
471-
(response, data) = self.api_call(method, path, params, sig_version=sig_version)
471+
(response, data) = self.api_call(method, path, params)
472472
return self.parse_json_response(response, data)
473473

474-
def json_paging_api_call(self, method, path, params, sig_version=None):
474+
def json_paging_api_call(self, method, path, params):
475475
"""
476476
Call a Duo API method which is expected to return a JSON body
477477
with a 200 status. Return a generator that can be used to get
@@ -485,13 +485,13 @@ def json_paging_api_call(self, method, path, params, sig_version=None):
485485

486486
while next_offset is not None:
487487
params['offset'] = str(next_offset)
488-
(response, data) = self.api_call(method, path, params, sig_version=sig_version)
488+
(response, data) = self.api_call(method, path, params)
489489
(objects, metadata) = self.parse_json_response_and_metadata(response, data)
490490
next_offset = metadata.get('next_offset', None)
491491
for obj in objects:
492492
yield obj
493493

494-
def json_cursor_api_call(self, method, path, params, get_records_func, sig_version=None):
494+
def json_cursor_api_call(self, method, path, params, get_records_func):
495495
"""
496496
Call a Duo API endpoint which utilizes a cursor in some responses to
497497
page through a set of data. This cursor is supplied through the optional
@@ -520,7 +520,7 @@ def json_cursor_api_call(self, method, path, params, get_records_func, sig_versi
520520
while True:
521521
if next_offset is not None:
522522
params['offset'] = str(next_offset)
523-
(http_resp, http_resp_data) = self.api_call(method, path, params, sig_version=sig_version)
523+
(http_resp, http_resp_data) = self.api_call(method, path, params)
524524
(response, metadata) = self.parse_json_response_and_metadata(
525525
http_resp,
526526
http_resp_data,

tests/admin/test_settings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ def test_update_settings(self):
6565
'telephony_warning_min': '50',
6666
'caller_id': '+15035551000',
6767
'user_telephony_cost_max': '10',
68+
'pending_deletion_days': '5',
6869
'minimum_password_length': '12',
6970
'password_requires_upper_alpha': '1',
7071
'password_requires_lower_alpha': '1',

0 commit comments

Comments
 (0)