mirror of https://github.com/MISP/PyMISP
Add methods to query the version of MISP (master and local)
parent
5fea22600e
commit
d735e6a3d3
|
@ -595,6 +595,27 @@ class PyMISP(object):
|
||||||
session = self.__prepare_session('rules')
|
session = self.__prepare_session('rules')
|
||||||
return session.get(template)
|
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 (Pure XML API should not be used) ##################
|
||||||
|
|
||||||
@deprecated
|
@deprecated
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -4,7 +4,7 @@ from setuptools import setup
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='pymisp',
|
name='pymisp',
|
||||||
version='1.9',
|
version='1.10',
|
||||||
author='Raphaël Vinot',
|
author='Raphaël Vinot',
|
||||||
author_email='raphael.vinot@circl.lu',
|
author_email='raphael.vinot@circl.lu',
|
||||||
maintainer='Raphaël Vinot',
|
maintainer='Raphaël Vinot',
|
||||||
|
|
Loading…
Reference in New Issue