I'm using the python Tornado framework to build an API and RequestHandler to handle the queries I get through the get() method.
My handler
handlers = [
(r"?", MainHandler)
]
class MainHandler(RequestHandler):
def get(self):
args = {
"text": RequestHandler.get_argument(self, "text", default=""),
"lang": RequestHandler.get_argument(self, "lang", default=""),
}
# Process the query
......
The issue is when the query is URL encoded like 'text%3DHi%26lang%3Den', the RequestHandler doesn't decode the query and identify its two parameters. Instead, it identifies the 'text' parameter value as 'Hi&lang=en'.
So, how do I read the arguments if they are URL encoded? Apparently RequestHandler.get_arguments() doesn't seem to be decoding them before parsing URL parameters