diff --git a/pymisp/api.py b/pymisp/api.py index 11a4fb8..dc457f4 100644 --- a/pymisp/api.py +++ b/pymisp/api.py @@ -595,6 +595,27 @@ class PyMISP(object): session = self.__prepare_session('rules') return session.get(template) + # ########## Version ########## + + def get_version(self): + """ + Returns the version of the instance. + """ + session = self.__prepare_session() + url = urljoin(self.root_url, 'servers/getVersion') + return session.get(url).json() + + def get_version_master(self): + """ + Get the most recent version from github + """ + r = requests.get('https://raw.githubusercontent.com/MISP/MISP/master/VERSION.json') + if r.status_code == 200: + master_version = json.loads(r.text) + return {'version': '{}.{}.{}'.format(master_version['major'], master_version['minor'], master_version['hotfix'])} + else: + return {'message': 'Impossible to retrieve the version of the master branch.'} + # ############## Deprecated (Pure XML API should not be used) ################## @deprecated diff --git a/setup.py b/setup.py index 42344d8..c7fc2e5 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ from setuptools import setup setup( name='pymisp', - version='1.9', + version='1.10', author='Raphaël Vinot', author_email='raphael.vinot@circl.lu', maintainer='Raphaël Vinot',