Skip to content

Commit

Permalink
new: get user config call
Browse files Browse the repository at this point in the history
  • Loading branch information
Rafiot committed Jun 17, 2024
1 parent 7c9f0a9 commit 6e1997d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions pylookyloo/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,14 @@ def init_apikey(self, username: str | None=None, password: str | None=None, apik
else:
raise AuthError('Unable to initialize API key')

def get_user_config(self) -> dict[str, Any] | None:
'''Get the configuration enforced by the server for the current user (requires an authenticated user, use init_apikey first)
'''
if not self.apikey:
raise AuthError('You need to initialize the apikey to use this method (see init_apikey)')
r = self.session.get(urljoin(self.root_url, str(PurePosixPath('json', 'get_user_config'))))
return r.json()

def misp_export(self, tree_uuid: str) -> dict[str, Any]:
'''Export the capture in MISP format'''
r = self.session.get(urljoin(self.root_url, str(PurePosixPath('json', tree_uuid, 'misp_export'))))
Expand Down

0 comments on commit 6e1997d

Please sign in to comment.