fromfunctoolsimportcached_propertyfromtypingimportTYPE_CHECKING,Any,Callable,OptionalfromwhistleimportEventfromharp.httpimportHttpRequestifTYPE_CHECKING:fromharp.httpimportHttpResponse#: Event fired when the ASGI Kernel receives a "lifespan" ASGI message.EVENT_CORE_STARTED="core.started"
[docs]classRequestEvent(Event):""" Request-aware event, that can resolve a controller from a request. """name="core.request"
#: Event fired when the ASGI Kernel has generated a response for a request, before it's sent, allowing to filter it.EVENT_CORE_RESPONSE=ResponseEvent.name
[docs]classViewEvent(RequestEvent):""" The view event allows to transform controller return values into response objects. """name="core.view"value:Anyresponse:Optional["HttpResponse"]
#: Event fired when the ASGI Kernel has called the resolved controller but got a non-HttpResponse return value, to allow#: transforming it into a response.EVENT_CORE_VIEW=ViewEvent.name