lint: reformat python code with black
This commit is contained in:
parent
331beb01b4
commit
a406a7974b
88 changed files with 2579 additions and 1608 deletions
|
@ -5,34 +5,38 @@ from werkzeug.exceptions import HTTPException
|
|||
from app.api.onion import api_onion
|
||||
from app.api.web import api_web
|
||||
|
||||
api = Blueprint('api', __name__)
|
||||
api.register_blueprint(api_onion, url_prefix='/onion')
|
||||
api.register_blueprint(api_web, url_prefix='/web')
|
||||
api = Blueprint("api", __name__)
|
||||
api.register_blueprint(api_onion, url_prefix="/onion")
|
||||
api.register_blueprint(api_web, url_prefix="/web")
|
||||
|
||||
|
||||
@api.errorhandler(400)
|
||||
def bad_request(error: HTTPException) -> ResponseReturnValue:
|
||||
response = jsonify({'error': 'Bad Request', 'message': error.description})
|
||||
response = jsonify({"error": "Bad Request", "message": error.description})
|
||||
response.status_code = 400
|
||||
return response
|
||||
|
||||
|
||||
@api.errorhandler(401)
|
||||
def unauthorized(error: HTTPException) -> ResponseReturnValue:
|
||||
response = jsonify({'error': 'Unauthorized', 'message': error.description})
|
||||
response = jsonify({"error": "Unauthorized", "message": error.description})
|
||||
response.status_code = 401
|
||||
return response
|
||||
|
||||
|
||||
@api.errorhandler(404)
|
||||
def not_found(_: HTTPException) -> ResponseReturnValue:
|
||||
response = jsonify({'error': 'Not found', 'message': 'Resource could not be found.'})
|
||||
response = jsonify(
|
||||
{"error": "Not found", "message": "Resource could not be found."}
|
||||
)
|
||||
response.status_code = 404
|
||||
return response
|
||||
|
||||
|
||||
@api.errorhandler(500)
|
||||
def internal_server_error(_: HTTPException) -> ResponseReturnValue:
|
||||
response = jsonify({'error': 'Internal Server Error', 'message': 'An unexpected error occurred.'})
|
||||
response = jsonify(
|
||||
{"error": "Internal Server Error", "message": "An unexpected error occurred."}
|
||||
)
|
||||
response.status_code = 500
|
||||
return response
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue