File: //home/arjun/projects/buyercall_new/buyercall/buyercall/blueprints/api2/restplus.py
import logging
from werkzeug.exceptions import BadRequest
from flask_restx import Api, apidoc
from config import settings
log = logging.getLogger(__name__)
authorizationz = {
'apikey': {
'type': 'apiKey',
'in': 'header',
'name': 'Authorize'
}
}
api = Api(version='2.0',
title='BuyerCall API',
description='Available API calls',
authorizations=authorizationz,
security='apikey')
@api.errorhandler
def default_error_handler(e):
message = 'An unhandled exception occurred.'
log.exception(message)
if not settings.DEBUG:
return {'message': message}, 500
@api.errorhandler(BadRequest)
def handle_root_exception(e):
return {'message': 'The browser (or proxy) sent a request that this server could not understand. Please review the request object structure for any inconsistencies.'}, 400