bottle Python HTTP query parameters minimal example
In order to obtain the value of a query parameter named myparam in bottle, first import request:
bottle_query_params.py
from bottle import requestand then use
example.py
request.params["myparam"]Full example:
bottle_query_server.py
#!/usr/bin/env python3
from bottle import route, run, request
@route('/test')
def hello():
query_param = request.params["myparam"]
return f"myparam is {query_param}"
run(host='localhost', port=8080, debug=True)Run this script and open http://localhost:8080/test?myparam=xyz in your browser - you will see
output.txt
myparam is xyzCheck out similar posts by category:
Python
If this post helped you, please consider buying me a coffee or donating via PayPal to support research & publishing of new posts on TechOverflow