【发布时间】:2021-09-03 22:18:36
【问题描述】:
在访问get_features POST api 时得到这个
RuntimeError: Working outside of request context
This typically means that you attempted to use functionality that needed
an active HTTP request. Consult the documentation on testing for
information about how to avoid this problem.
@api_v1.route('/get_features', methods=['POST'])
async def get_features():
results = []
with app.app_context():
inputs = request.json
responses = await get_features_for_all(inputs)
for response in responses:
results.append(response)
return jsonify({'result': results})
【问题讨论】:
标签: flask python-asyncio flask-restful