Use request.query
to retrieve the url parameters
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
| #coding: utf-8
from bottle import *
@route('/')
@route('/index.html')
def index():
return '<a href="/hello">Go to Hello page</a>'
@route('/hello')
def hello():
name = None
names = request.query.getall('name')
if names:
name = names[0]
return '<h1>Hello %s</h1>' % name
run(host='localhost', port=8000, reloader=True)
|