Reputation: 8200
I'm trying to pass several parameters using POST or PUT, but I'm getting only first
@route('/command/', method='PUT')
def execute(command="Unknown"):
param1 = request.query.get("param1")
param2 = request.query.get("param2")
param3 = request.query.get("param3")
print("{} {} {} {}".format(command, param1, param2, param3))
return "Executed {} {} {} {}".format(command, param1, param2, param3)
using the request like this:
curl -X PUT http://host:port/mycommand/?param1=value1¶m2=value2¶m3=value3
Bottle logs: "PUT /command/?param1=value1 HTTP/1.1"
and param2 and param3 are printed out as "None", like they are cut off on the &
Upvotes: 2
Views: 232
Reputation: 474231
You need to put quotes around the URL:
curl -X PUT "http://host:port/mycommand/?param1=value1¶m2=value2¶m3=value3"
Upvotes: 2