我正在尝试将两个参数发送到使用 Flask 路由的 URL。
If I do:
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
and endStationName
定义的。
然而,相反,似乎只收到第一个参数:
ImmutableMultiDict([('startStationName', u'Hansard Mews, Shepherds Bush')])
有人知道我做错了什么吗?我有一种感觉,一定是某个地方出现了某种愚蠢的错误或误解,但我已经找了一个小时了,但找不到。
Your shell解释了&
as a 将命令置于后台特点 http://linuxcommand.org/lts0080.php。为了防止这种情况,请引用整个 URL:
curl -i "http://127.0.0.1:5000/api/journeys/count?startStationName=Hansard%20Mews,%20Shepherds%20Bush&endStationName=Farringdon%20Lane,%20Clerkenwell"
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)