【发布时间】:2021-06-25 15:13:40
【问题描述】:
我试图获取请求参数并想在 sanic 中使用分页。是sanic电机。已使用 mongodb 查找详细信息。我想使用限制和跳过。
@app.route("/query", methods=["GET"])
async def query_params(request, count=10, page=1):
a = request.args
count = request.args['count'][0]
page = a.get('page')
students = await Student.find(as_raw=True).skip((page-1) * count).limit(count)
return json_response(students.objects)
它给出错误 AttributeError: 'coroutine' object has no attribute 'skip' while processing path /query 同样的限制我得到这个错误
【问题讨论】:
标签: pagination sanic