Home Assistant Unofficial Reference 2024.12.1
homeassistant.helpers.http.HomeAssistantView Class Reference
Inheritance diagram for homeassistant.helpers.http.HomeAssistantView:
[legend]

Public Member Functions

web.Response json_message (self, str message, HTTPStatus|int status_code=HTTPStatus.OK, str|None message_code=None, LooseHeaders|None headers=None)
 
None register (self, HomeAssistant hass, web.Application app, web.UrlDispatcher router)
 

Static Public Member Functions

Context context (web.Request request)
 
web.Response json (Any result, HTTPStatus|int status_code=HTTPStatus.OK, LooseHeaders|None headers=None)
 

Static Public Attributes

bool cors_allowed = False
 
 None
 
bool requires_auth = True
 

Detailed Description

Base view for all views.

Definition at line 107 of file http.py.

Member Function Documentation

◆ context()

Context homeassistant.helpers.http.HomeAssistantView.context ( web.Request  request)
static
Generate a context from a request.

Definition at line 117 of file http.py.

◆ json()

web.Response homeassistant.helpers.http.HomeAssistantView.json ( Any  result,
HTTPStatus | int   status_code = HTTPStatus.OK,
LooseHeaders | None   headers = None 
)
static
Return a JSON response.

Definition at line 125 of file http.py.

◆ json_message()

web.Response homeassistant.helpers.http.HomeAssistantView.json_message (   self,
str  message,
HTTPStatus | int   status_code = HTTPStatus.OK,
str | None   message_code = None,
LooseHeaders | None   headers = None 
)
Return a JSON message response.

Definition at line 151 of file http.py.

◆ register()

None homeassistant.helpers.http.HomeAssistantView.register (   self,
HomeAssistant  hass,
web.Application  app,
web.UrlDispatcher   router 
)
Register the view with a router.

Definition at line 164 of file http.py.

Member Data Documentation

◆ cors_allowed

bool homeassistant.helpers.http.HomeAssistantView.cors_allowed = False
static

Definition at line 114 of file http.py.

◆ None

homeassistant.helpers.http.HomeAssistantView.None
static

Definition at line 110 of file http.py.

◆ requires_auth

bool homeassistant.helpers.http.HomeAssistantView.requires_auth = True
static

Definition at line 113 of file http.py.


The documentation for this class was generated from the following file: