I know that in Tornado one can capture some parts of URL's using regular expressions, but isn't there a more structured way to access path parameters? Maybe something similar to the way you access query arguments (RequestHandler.get_query_argument()
)?
Asked
Active
Viewed 1,405 times
2

SCGH
- 887
- 8
- 13
2 Answers
1
All the path arguments are available in RequestHandler.path_args
, or in RequestHandler.path_kwargs
if you used named groups in your regex. See http://www.tornadoweb.org/en/stable/web.html#tornado.web.RequestHandler.path_args for more details.

Berislav Lopac
- 16,656
- 6
- 71
- 80
1
The answer is no. Tornado doesn't know anything about what's inside path segments. The only way to access more detailed information, codified in path segments, is to use regular expressions.

SCGH
- 887
- 8
- 13