Add methods to query the version of MISP (master and local)

pull/2/merge
Raphaël Vinot 2015-09-17 13:51:31 +02:00
parent 5fea22600e
commit d735e6a3d3
2 changed files with 22 additions and 1 deletions

View File

@ -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

View File

@ -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',