Initial commit

This commit is contained in:
2021-01-24 19:51:48 +01:00
commit 42c1c5fa66
13 changed files with 1003 additions and 0 deletions
+23
View File
@@ -0,0 +1,23 @@
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