fasjson.web.apis package¶
Submodules¶
fasjson.web.apis.base module¶
- class fasjson.web.apis.base.FasJsonApi(app=None, version='1.0', title=None, description=None, terms_url=None, license=None, license_url=None, contact=None, contact_url=None, contact_email=None, authorizations=None, security=None, doc='/', default_id=<function default_id>, default='default', default_label='Default namespace', validate=None, tags=None, prefix='', ordered=False, default_mediatype='application/json', decorators=None, catch_all_404s=False, serve_challenge_on_401=False, format_checker=None, url_scheme=None, default_swagger_filename='swagger.json', **kwargs)[source]¶
Bases:
Api
- init_app(app, **kwargs)[source]¶
Allow to lazy register the API on a Flask application:
>>> app = Flask(__name__) >>> api = Api() >>> api.init_app(app)
- Parameters:
app (flask.Flask) – the Flask application object
title (str) – The API title (used in Swagger documentation)
description (str) – The API description (used in Swagger documentation)
terms_url (str) – The API terms page URL (used in Swagger documentation)
contact (str) – A contact email for the API (used in Swagger documentation)
license (str) – The license associated to the API (used in Swagger documentation)
license_url (str) – The license page URL (used in Swagger documentation)
url_scheme – If set to a string (e.g. http, https), then the specs_url and base_url will explicitly use this scheme regardless of how the application is deployed. This is necessary for some deployments behind a reverse proxy.
- fasjson.web.apis.base.handle_ldap_local_error(error)[source]¶
When an LDAP local error occurs, return a 500 status code.
- Parameters:
error (ldap.LOCAL_ERROR) – the exception that was raised
- Returns:
a description of the error
- Return type:
- fasjson.web.apis.base.handle_ldap_server_error(error)[source]¶
When the LDAP server is down, return a 500 status code.
- Parameters:
error (ldap.SERVER_DOWN) – the exception that was raised
- Returns:
a description of the error
- Return type:
- fasjson.web.apis.base.handle_rpc_error(error)[source]¶
When a JSON-RPC error occurs, return a 400 status code.
Warning, the exception does not always have a
code
attribute.- Parameters:
error (python_freeipa.exceptions.BadRequest) – the exception that was raised
- Returns:
a description of the error
- Return type: