示例#1
0
 def __init__(self):
     self.logger = logger_setup(self.debug)
示例#2
0
    DEBUG = False


def handle_exception(exc_type, exc_value, exc_traceback):
    """ exception handler """
    if issubclass(exc_type, KeyboardInterrupt):
        sys.__excepthook__(exc_type, exc_value, exc_traceback)
        return

    LOGGER.error("Uncaught exception",
                 exc_info=(exc_type, exc_value, exc_traceback))
    # LOGGER.error("Uncaught exception")


# initialize logger
LOGGER = logger_setup(DEBUG)

with Housekeeping(DEBUG, LOGGER) as housekeeping:
    housekeeping.dbversion_check(__dbversion__)

# examption handling via logger
sys.excepthook = handle_exception

HTTP_CODE_DIC = {
    200: 'Created',
    201: 'OK',
    400: 'Bad Request',
    401: 'Unauthorized',
    403: 'Forbidden',
    404: 'Not Found',
    405: 'Method Not Allowed',