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

@@ -128,7 +128,7 @@ def create_api_key(service_id):
@login_required
@user_has_permissions('manage_api_keys')
def revoke_api_key(service_id, key_id):
key_name = api_key_api_client.get_api_keys(service_id=service_id, key_id=key_id)['apiKeys'][0]['name']
key_name = current_service.get_api_key(key_id)['name']
if request.method == 'GET':
return render_template(
'views/api/keys.html',