INNER CODE UNIT · Python

http_error_handler

hyperonym/basaran · basaran/__main__.py:254

def http_error_handler(error):
    """Handler function for all expected HTTP errors."""
    return jsonify(error={"message": error.description}), error.code


def main():
    """Start serving API requests."""
    print(f"start listening on {HOST}:{PORT}")
    waitress.serve(
        app,
        host=HOST,
        port=PORT,
        threads=SERVER_THREADS,
        ident=SERVER_IDENTITY,
        connection_limit=SERVER_CONNECTION_LIMIT,
        channel_timeout=SERVER_CHANNEL_TIMEOUT,
    )

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…