mirror of https://github.com/MISP/PyMISP
parent
d735e6a3d3
commit
a7c3d8869c
|
@ -1 +1,3 @@
|
||||||
|
__version__ = '1.10'
|
||||||
|
|
||||||
from .api import PyMISP
|
from .api import PyMISP
|
||||||
|
|
|
@ -5,9 +5,10 @@
|
||||||
|
|
||||||
import json
|
import json
|
||||||
import datetime
|
import datetime
|
||||||
import requests
|
|
||||||
import os
|
import os
|
||||||
import base64
|
import base64
|
||||||
|
import re
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from urllib.parse import urljoin
|
from urllib.parse import urljoin
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
@ -17,6 +18,14 @@ import zipfile
|
||||||
import warnings
|
import warnings
|
||||||
import functools
|
import functools
|
||||||
|
|
||||||
|
try:
|
||||||
|
import requests
|
||||||
|
HAVE_REQUESTS = True
|
||||||
|
except ImportError:
|
||||||
|
HAVE_REQUESTS = False
|
||||||
|
|
||||||
|
from . import __version__
|
||||||
|
|
||||||
# Least dirty way to support python 2 and 3
|
# Least dirty way to support python 2 and 3
|
||||||
try:
|
try:
|
||||||
basestring
|
basestring
|
||||||
|
@ -38,6 +47,10 @@ class NewAttributeError(PyMISPError):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
|
class MissingDependency(PyMISPError):
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def deprecated(func):
|
def deprecated(func):
|
||||||
'''This is a decorator which can be used to mark functions
|
'''This is a decorator which can be used to mark functions
|
||||||
as deprecated. It will result in a warning being emitted
|
as deprecated. It will result in a warning being emitted
|
||||||
|
@ -92,6 +105,8 @@ class PyMISP(object):
|
||||||
(overwrite the constructor)
|
(overwrite the constructor)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
if not HAVE_REQUESTS:
|
||||||
|
raise MissingDependency('Missing dependency, install requests (`pip install requests`)')
|
||||||
if force_out is not None:
|
if force_out is not None:
|
||||||
out = force_out
|
out = force_out
|
||||||
else:
|
else:
|
||||||
|
@ -597,6 +612,23 @@ class PyMISP(object):
|
||||||
|
|
||||||
# ########## Version ##########
|
# ########## Version ##########
|
||||||
|
|
||||||
|
def get_api_version(self):
|
||||||
|
"""
|
||||||
|
Returns the current version of PyMISP installed on the system
|
||||||
|
"""
|
||||||
|
return {'version': __version__}
|
||||||
|
|
||||||
|
def get_api_version_master(self):
|
||||||
|
"""
|
||||||
|
Get the most recent version of PyMISP from github
|
||||||
|
"""
|
||||||
|
r = requests.get('https://raw.githubusercontent.com/MISP/PyMISP/master/pymisp/__init__.py')
|
||||||
|
if r.status_code == 200:
|
||||||
|
version = re.findall("__version__ = '(.*)'", r.text)
|
||||||
|
return {'version': version[0]}
|
||||||
|
else:
|
||||||
|
return {'message': 'Impossible to retrieve the version of the master branch.'}
|
||||||
|
|
||||||
def get_version(self):
|
def get_version(self):
|
||||||
"""
|
"""
|
||||||
Returns the version of the instance.
|
Returns the version of the instance.
|
||||||
|
|
4
setup.py
4
setup.py
|
@ -1,10 +1,12 @@
|
||||||
#!/usr/bin/python
|
#!/usr/bin/python
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
|
import pymisp
|
||||||
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='pymisp',
|
name='pymisp',
|
||||||
version='1.10',
|
version=pymisp.__version__,
|
||||||
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