Created
June 4, 2016 01:51
-
-
Save tomotaka/24b667b048aa1a08296b39942c9c064d to your computer and use it in GitHub Desktop.
get url, query string, path in bottle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import bottle | |
from wsgiref import simple_server | |
b = bottle.Bottle() | |
def test(): | |
path = bottle.request.path | |
urlargs = bottle.request.url_args | |
query_string = bottle.request.query_string | |
url = bottle.request.url | |
return 'your path = %s, urlargs=%s, qs=%s, url=%s' % (path, urlargs, query_string, url) | |
b.route('/', ['GET'], test) | |
sv = simple_server.make_server('', 8080, b) | |
sv.serve_forever() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment