DocScoDoc/app/api/__init__.py

35 lines
999 B
Python

"""api.__init__
"""
from flask import Blueprint
from flask import request
api_bp = Blueprint("api", __name__)
api_web_bp = Blueprint("apiweb", __name__)
def requested_format(default_format="json", allowed_formats=None):
"""Extract required format from query string.
* default value is json. A list of allowed formats may be provided
(['json'] considered if not provided).
* if the required format is not in allowed list, returns None.
NB: if json in not in allowed_formats, format specification is mandatory.
"""
format_type = request.args.get("format", default_format)
if format_type in (allowed_formats or ["json"]):
return format_type
return None
from app.api import tokens
from app.api import departements
from app.api import etudiants
from app.api import formations
from app.api import formsemestres
from app.api import partitions
from app.api import evaluations
from app.api import jury
from app.api import absences
from app.api import logos