-
-
Notifications
You must be signed in to change notification settings - Fork 813
Closed
Milestone
Description
This example: https://github.com/simonw/datasette/blob/f5e79adf26d0daa3831e3fba022f1b749a9efdee/docs/plugins.rst#register_routes
from datasette.utils.asgi import Response
import html
async def hello_from(scope):
name = scope["url_route"]["kwargs"]["name"]
return Response.html("Hello from {}".format(
html.escape(name)
))
@hookimpl
def register_routes():
return [
(r"^/hello-from/(?P<name>.*)$"), hello_from)
]Would be nicer if you could easily get scope["url_route"]["kwargs"]["name"] directly from the request object, without looking at the scope.
Reactions are currently unavailable