Esempio n. 1
0
def index():
    output = []
    for rule in app.url_map.iter_rules():

        options = {}
        for arg in rule.arguments:
            options[arg] = "[{0}]".format(arg)
        url = url_for(rule.endpoint, **options)
        line = unquote("{}".format(url))
        output.append(line)
    return response_parser(data=output)
Esempio n. 2
0
def generic_post_request_api(version, primary_schema, request_type):
    if request.method == 'POST':
        data = APP_ROUTER[version].schema_special_post_request(
            version=version,
            primary_schema=primary_schema,
            request_type=request_type, **request_parser())
    elif request.method == 'GET':
        data = APP_ROUTER[version].schema_special_get_request(
            version=version,
            primary_schema=primary_schema,
            request_type=request_type,
            **request_parser())
    return response_parser(data=data)
Esempio n. 3
0
def generic_schema_api(version, primary_schema):
    if request.method == "GET":
        data = APP_ROUTER[version].schema_get(
            version=version,
            primary_schema=primary_schema,
            **request_parser())
    elif request.method == "POST":
        data = APP_ROUTER[version].schema_post(
            version=version,
            primary_schema=primary_schema,
            **request_parser())
    else:
        raise CustomException('Invalid Request', Codes.NOT_ALLOWED)
    return response_parser(data=data)
Esempio n. 4
0
def generic_primary_id_api(version, primary_schema, _id):
    if request.method == "GET":
        data = APP_ROUTER[version].schema_id_get(
            version=version,
            primary_schema=primary_schema,
            _id=_id, **request_parser())
    elif request.method == "PUT":
        data = APP_ROUTER[version].schema_id_put(
            version=version,
            primary_schema=primary_schema,
            _id=_id, **request_parser())
    elif request.method == "DELETE":
        data = APP_ROUTER[version].schema_id_delete(
            version=version,
            primary_schema=primary_schema,
            _id=_id, **request_parser())
    else:
        raise CustomException('Invalid Request', Codes.NOT_ALLOWED)
    return response_parser(data=data)
Esempio n. 5
0
def page_not_found(error):
    return response_parser(response={"status": "405", "error_msg": "API Not found."})
Esempio n. 6
0
def unsubscribe(version):
    data = APP_ROUTER[version].unsubscribe(version=version, **request_parser())
    return response_parser(data=data)
Esempio n. 7
0
def get_token(version):
    data = APP_ROUTER[version].token(version=version,
                                     dr_action="handle_ref_token", **request_parser())
    return response_parser(data=data)
Esempio n. 8
0
def reset_password(version):
    data = APP_ROUTER[version].reset_password(version=version,
                                              dr_action="attach_token", **request_parser())
    return response_parser(data=data)
Esempio n. 9
0
def forgot_password(version):
    data = APP_ROUTER[version].forgot_password(version=version, **request_parser())
    return response_parser(data=data)
Esempio n. 10
0
def login(version):
    data = APP_ROUTER[version].login(version=version, **request_parser())
    return response_parser(data=data)