Get raw query string in flask
There are several request
attributes that let you access the raw url:
Imagine your application is listening on the following URL:
http://www.example.com/myapplication
And a user requests the following URL:
http://www.example.com/myapplication/page.html?x=y
In this case the values of the above mentioned attributes would be the following:
path /page.htmlscript_root /myapplicationbase_url http://www.example.com/myapplication/page.htmlurl http://www.example.com/myapplication/page.html?x=yurl_root http://www.example.com/myapplication/
These, eventually with the help of urlparse
, will let you extract the information you need:
>>> from urlparse import urlparse >>> urlparse(request.url).query 'x=y'