def call_action(api, resource, action, data=None, headers=None):
    # support resp.json before flask 1.0
    if not hasattr(api.app, 'json'):
        make_json_response(api.app)

    actions = api.resources[resource]['actions']
    for act in actions:
        if act.action == action:
            action = act
            break
    else:
        raise ValueError('action=%s not exists' % action)
    url = action.url
    if api.url_prefix:
        url = api.url_prefix + url
    if headers is None:
        headers = {}
    data_param = {}
    if action.method in ["get", "delete"]:
        data_param["query_string"] = data
    elif action.method in ["post", "put"]:
        data_param["data"] = json.dumps(data, ensure_ascii=False)
    with api.app.test_client() as c:
        resp = c.open(url, method=action.method, headers=headers,
                      content_type="application/json", **data_param)
        return resp
Application processor to setup session for every request
dataset/ETHPy150Open guyskk/flask-restaction/flask_restaction/res.py/call_action--crossover with--dataset/ETHPy150Open wecatch/app-turbo/turbo/session.py/Session._processor