mirror of https://github.com/MISP/PyMISP
chg: Add deprecation warning for Python < 3.8
parent
4730452ce0
commit
3d3e9abc1d
|
@ -1,5 +1,7 @@
|
||||||
__version__ = '2.4.138'
|
__version__ = '2.4.138'
|
||||||
import logging
|
import logging
|
||||||
|
import sys
|
||||||
|
import warnings
|
||||||
|
|
||||||
FORMAT = "%(levelname)s [%(filename)s:%(lineno)s - %(funcName)s() ] %(message)s"
|
FORMAT = "%(levelname)s [%(filename)s:%(lineno)s - %(funcName)s() ] %(message)s"
|
||||||
formatter = logging.Formatter(FORMAT)
|
formatter = logging.Formatter(FORMAT)
|
||||||
|
@ -11,6 +13,14 @@ logger.addHandler(default_handler)
|
||||||
logger.setLevel(logging.WARNING)
|
logger.setLevel(logging.WARNING)
|
||||||
|
|
||||||
|
|
||||||
|
def warning_2022():
|
||||||
|
if sys.version_info < (3, 8):
|
||||||
|
warnings.warn("""
|
||||||
|
As our baseline system is the latest Ubuntu LTS, and Ubuntu LTS 20.04 has Python 3.8 available,
|
||||||
|
we will officially deprecate python versions below 3.8 on January 1st 2022.
|
||||||
|
**Please update your codebase.**""", DeprecationWarning, stacklevel=3)
|
||||||
|
|
||||||
|
|
||||||
everything_broken = '''Unknown error: the response is not in JSON.
|
everything_broken = '''Unknown error: the response is not in JSON.
|
||||||
Something is broken server-side, please send us everything that follows (careful with the auth key):
|
Something is broken server-side, please send us everything that follows (careful with the auth key):
|
||||||
Request headers:
|
Request headers:
|
||||||
|
@ -22,6 +32,7 @@ Response (if any):
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
warning_2022()
|
||||||
from .exceptions import PyMISPError, NewEventError, NewAttributeError, MissingDependency, NoURL, NoKey, InvalidMISPObject, UnknownMISPObjectTemplate, PyMISPInvalidFormat, MISPServerError, PyMISPNotImplementedYet, PyMISPUnexpectedResponse, PyMISPEmptyResponse # noqa
|
from .exceptions import PyMISPError, NewEventError, NewAttributeError, MissingDependency, NoURL, NoKey, InvalidMISPObject, UnknownMISPObjectTemplate, PyMISPInvalidFormat, MISPServerError, PyMISPNotImplementedYet, PyMISPUnexpectedResponse, PyMISPEmptyResponse # noqa
|
||||||
from .abstract import AbstractMISP, MISPEncode, pymisp_json_default, MISPTag, Distribution, ThreatLevel, Analysis # noqa
|
from .abstract import AbstractMISP, MISPEncode, pymisp_json_default, MISPTag, Distribution, ThreatLevel, Analysis # noqa
|
||||||
from .mispevent import MISPEvent, MISPAttribute, MISPObjectReference, MISPObjectAttribute, MISPObject, MISPUser, MISPOrganisation, MISPSighting, MISPLog, MISPShadowAttribute, MISPWarninglist, MISPTaxonomy, MISPNoticelist, MISPObjectTemplate, MISPSharingGroup, MISPRole, MISPServer, MISPFeed, MISPEventDelegation, MISPUserSetting, MISPInbox, MISPEventBlocklist, MISPOrganisationBlocklist, MISPEventReport # noqa
|
from .mispevent import MISPEvent, MISPAttribute, MISPObjectReference, MISPObjectAttribute, MISPObject, MISPUser, MISPOrganisation, MISPSighting, MISPLog, MISPShadowAttribute, MISPWarninglist, MISPTaxonomy, MISPNoticelist, MISPObjectTemplate, MISPSharingGroup, MISPRole, MISPServer, MISPFeed, MISPEventDelegation, MISPUserSetting, MISPInbox, MISPEventBlocklist, MISPOrganisationBlocklist, MISPEventReport # noqa
|
||||||
|
|
Loading…
Reference in New Issue