Merge pull request #257 from mokaddem/usersStatistics

new: [usersStats] Possibility to fetch users/statistics
pull/317/head
Raphaël Vinot 2018-12-17 19:37:54 +01:00 committed by GitHub
commit 14921ea30b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 9 additions and 0 deletions

View File

@ -1422,6 +1422,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):