Don’t do multiple get API calls when revoking

It’s redundant to make two API calls here, one to get all keys and one
to get a single key. Since the API calls are sequential we can speed
things up by getting the one key from the list of all keys.
This commit is contained in:
Chris Hill-Scott
2018-11-07 11:53:29 +00:00
parent d1c9dcfb1d
commit 591bbe9a49
5 changed files with 33 additions and 19 deletions

View File

@@ -10,11 +10,8 @@ class ApiKeyApiClient(NotifyAdminAPIClient):
def __init__(self):
super().__init__("a" * 73, "b")
def get_api_keys(self, service_id, key_id=None):
if key_id:
return self.get(url='/service/{}/api-keys/{}'.format(service_id, key_id))
else:
return self.get(url='/service/{}/api-keys'.format(service_id))
def get_api_keys(self, service_id):
return self.get(url='/service/{}/api-keys'.format(service_id))
def create_api_key(self, service_id, key_name, key_type):
data = {