From 06b829e7813ce6d967b9b0a24385dde19e682ad2 Mon Sep 17 00:00:00 2001 From: Sami Mokaddem Date: Mon, 13 Aug 2018 12:10:15 +0200 Subject: [PATCH] new: [usersStats] Possibility to fetch users/statistics data for all context (usage, org, tags, ...) --- pymisp/api.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pymisp/api.py b/pymisp/api.py index e189c15..cee2caf 100644 --- a/pymisp/api.py +++ b/pymisp/api.py @@ -1366,6 +1366,15 @@ class PyMISP(object): response = self._prepare_request('GET', url) return self._check_response(response) + def get_users_statistics(self, context='data'): + """Get users statistics from the MISP instance""" + availables_contexts = ['data', 'orgs', 'users', 'tags', 'attributehistogram', 'sightings', 'attackMatrix'] + if context not in availables_contexts: + context = 'data' + url = urljoin(self.root_url, 'users/statistics/{}.json'.format(context)) + response = self._prepare_request('GET', url) + return self._check_response(response) + # ############## Sightings ################## def sighting_per_id(self, attribute_id):