You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
docker-net-dhcp/net-dhcp/__init__.py

24 lines
485 B
Python

import logging
from flask import Flask, jsonify
class NetDhcpError(Exception):
def __init__(self, status, *args):
Exception.__init__(self, *args)
self.status = status
app = Flask(__name__)
from . import network
logger = logging.getLogger('gunicorn.error')
@app.errorhandler(404)
def err_not_found(_e):
return jsonify({'Err': 'API not found'}), 404
@app.errorhandler(Exception)
def err(e):
logger.exception(e)
return jsonify({'Err': str(e)}), 500