我有这个Python代码:
@reports_api.route('/reports/xlsx/organisations/<int:organisation_id>/', methods=['GET'])
@reconnect_to_db
@check_permissions(request, employee_constraints={}, client_user_constraints={}, in_args=True)
def get_organisation_containers_report_xlsx(organisation_id, employee_id):
if request.method == 'GET':
recipient = request.args.get('recipient')
report_str_io = ExcelReportsManager.get_organisation_containers_report(organisation_id, employee_id, recipient == 'up')
return flask.jsonify(**report_str_io), 200
当我使用这个api的路由时,我遇到了错误
^{pr2}$有一条通向api的路径:
http://localhost:5000/reports/xlsx/organisations/1/?employee_id=2
我做错什么了?在
函数参数中有错误。需要使用
request.args.get('employee_id')
。在代码如下:
当我们将参数发送到api的路径中时,它会工作,如下所示:
^{pr2}$如果第一个函数加上第一个参数,那么就把它当作第一个函数。在
相关问题 更多 >
编程相关推荐