add function get_tags_statistics

pull/19/head
Déborah Servili 2016-05-23 15:16:31 +02:00
parent 5108d78f8d
commit d781b4690f
1 changed files with 22 additions and 6 deletions

View File

@ -981,7 +981,7 @@ class PyMISP(object):
def get_attributes_statistics(self, context='type', percentage=None, force_out=None): def get_attributes_statistics(self, context='type', percentage=None, force_out=None):
""" """
Get statistics from the MISP instance Get attributes statistics from the MISP instance
""" """
session = self.__prepare_session(force_out) session = self.__prepare_session(force_out)
if (context != 'category'): if (context != 'category'):
@ -992,7 +992,23 @@ class PyMISP(object):
url = urljoin(self.root_url, 'attributes/attributeStatistics/{}'.format(context)) url = urljoin(self.root_url, 'attributes/attributeStatistics/{}'.format(context))
return session.get(url).json() return session.get(url).json()
# ############## Sightings ################## def get_tags_statistics(self, percentage=None, name_sort=None, force_out=None):
"""
Get tags statistics from the MISP instance
"""
session = self.__prepare_session(force_out)
if (percentage != None):
percentage = 'true'
else:
percentage = 'false'
if (name_sort != None):
name_sort = 'true'
else:
name_sort = 'false'
url = urljoin(self.root_url, 'tags/tagStatistics/{}/{}'.format(percentage, name_sort))
return session.get(url).json()
# ############## Sightings ##################
def sighting_per_id(self, attribute_id, force_out=None): def sighting_per_id(self, attribute_id, force_out=None):
session = self.__prepare_session(force_out) session = self.__prepare_session(force_out)