fix: Incorrect call when requesting a new API key

pull/835/head
Raphaël Vinot 2022-03-03 19:09:58 +01:00
parent a347f0ed4e
commit 883889c9c5
1 changed files with 2 additions and 2 deletions

View File

@ -2197,8 +2197,8 @@ class PyMISP:
:param user: The owner of the key
'''
data = {"user_id": get_uuid_or_id_from_abstract_misp(user)}
r = self._prepare_request('POST', '/auth_keys/add', data=data)
user_id = get_uuid_or_id_from_abstract_misp(user)
r = self._prepare_request('POST', f'/auth_keys/add/{user_id}', data={})
authkey = self._check_json_response(r)
if 'AuthKey' in authkey and 'authkey_raw' in authkey['AuthKey']:
return authkey['AuthKey']['authkey_raw']