ΠŸΠ΅Ρ€Π΅ΠΉΡ‚ΠΈ ΠΊ ΡΠΎΠ΄Π΅Ρ€ΠΆΠ°Π½ΠΈΡŽ

Redirect class

Warning

The current page still doesn't have a translation for this language.

But you can help translating it: Contributing.

esmerald.datastructures.redirect.Redirect

Bases: ResponseContainer[RedirectResponse]

path instance-attribute

path

The url path to redirect. This should be in format of /<str>.

Example: /redirect-page.

to_response

to_response(headers, media_type, status_code, app)
PARAMETER DESCRIPTION
headers

TYPE: Dict[str, Any]

media_type

TYPE: Union[MediaType, str]

status_code

TYPE: int

app

TYPE: Type[Esmerald]

Source code in esmerald/datastructures/redirect.py
26
27
28
29
30
31
32
33
34
35
36
37
38
def to_response(
    self,
    headers: Dict[str, Any],
    media_type: Union["MediaType", str],
    status_code: int,
    app: Type["Esmerald"],
) -> RedirectResponse:
    return RedirectResponse(
        headers=headers,
        status_code=status_code,
        url=self.path,
        background=self.background,
    )