from flask import Blueprint from calendar import timegm from email.utils import formatdate from functools import partial api = Blueprint('api', __name__) def truthy_bool(param): return param not in {False, 'false', 'False', '0', 'FALSE', '', 'null'} def format_date(date): """ Output an RFC822 date format. """ return formatdate(timegm(date.utctimetuple())) def add_method_metadata(name, value): def modifier(func): if '__api_metadata' not in dir(func): func.__metadata = {} func.__metadata[name] = value return func return modifier def method_metadata(func, name): if '__api_metadata' in dir(func): return func.__metadata.get(name, None) return None nickname = partial(add_method_metadata, 'nickname') import endpoints.api.legacy import endpoints.api.repository import endpoints.api.discovery