我正在尝试将两个参数发送到使用Flask路由的URL。
如果我做:
curl -i http://127.0.0.1:5000/api/journeys/count?startStationName=Hansard%20Mews,%20Shepherds%20Bush&endStationName=Farringdon%20Lane,%20Clerkenwell
然后我的代码是:
@application.route('/api/journeys/count', methods=['GET'])
def journeys():
print request.args
startStationName = request.args.get('startStationName')
endStationName = request.args.get('endStationName')
应该用startStationName
和endStationName
定义一个字典。
但是,相反,似乎只接收到第一个参数:
ImmutableMultiDict([('startStationName', u'Hansard Mews, Shepherds Bush')])
有人知道我在做什么错吗?我觉得某个地方肯定有一些愚蠢的错误或误解,但我一直在找一个小时,找不到它。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句