How to retrieve GET vars in python bottle app
They are stored in the request.query
object.
http://bottlepy.org/docs/dev/tutorial.html#query-variables
It looks like you can also access them by treating the request.query
attribute like a dictionary:
request.query['city']
So dict(request.query)
would create a dictionary of all the query parameters.
As @mklauber notes, this will not work for multi-byte characters. It looks like the best method is:
my_dict = request.query.decode()
or:
dict(request.query.decode())
to have a dict
instead of a <bottle.FormsDict object at 0x000000000391B...>
object.
If you want them all:
from urllib.parse import parse_qsdict = parse_qs(request.query_string)
If you want one:
one = request.GET.get('one', '').strip()
Can you try this please:
For this example : http://localhost:8080/command?param_name=param_value
In your code:
param_value = request.query.param_name