Reputation: 14641
I've a subscriber function to BeforeRender event. Each time a request is made, this function is being called.
Here I want to analyse the given request url but I fail in accessing the request.application_url or request.route_url
How can I get the requested url and print it in the console each time a request's been made?
Upvotes: 2
Views: 455
Reputation: 23331
event['request']
will yield the request
object you need. From there you can look at various properties, all of which are documented. For example request.path_info
will be the /path/to/this/view
.
BeforeRender
is only invoked when a renderer is used on a view or render()
or render_to_response()
are called. For every request you can use a NewRequest
event or ContextFound
.
Upvotes: 3