MCPcopy Create free account
hub / github.com/EasyIME/PIME / redirect

Method redirect

python/python3/tornado/web.py:798–816  ·  view source on GitHub ↗

Sends a redirect to the given (optionally relative) URL. If the ``status`` argument is specified, that value is used as the HTTP status code; otherwise either 301 (permanent) or 302 (temporary) is chosen based on the ``permanent`` argument. The default is 302 (tempor

(
        self, url: str, permanent: bool = False, status: Optional[int] = None
    )

Source from the content-addressed store, hash-verified

796 return get_signature_key_version(value)
797
798 def redirect(
799 self, url: str, permanent: bool = False, status: Optional[int] = None
800 ) -> None:
801 """Sends a redirect to the given (optionally relative) URL.
802
803 If the ``status`` argument is specified, that value is used as the
804 HTTP status code; otherwise either 301 (permanent) or 302
805 (temporary) is chosen based on the ``permanent`` argument.
806 The default is 302 (temporary).
807 """
808 if self._headers_written:
809 raise Exception("Cannot redirect after headers have been written")
810 if status is None:
811 status = 301 if permanent else 302
812 else:
813 assert isinstance(status, int) and 300 <= status <= 399
814 self.set_status(status)
815 self.set_header("Location", utf8(url))
816 self.finish()
817
818 def write(self, chunk: Union[str, bytes, dict]) -> None:
819 """Writes the given chunk to the output buffer.

Callers 13

postMethod · 0.80
authenticate_redirectMethod · 0.80
_on_request_tokenMethod · 0.80
authorize_redirectMethod · 0.80
wrapperFunction · 0.80
getMethod · 0.80
getMethod · 0.80
prepareMethod · 0.80
getMethod · 0.80
getMethod · 0.80
getMethod · 0.80

Calls 4

set_statusMethod · 0.95
set_headerMethod · 0.95
finishMethod · 0.95
utf8Function · 0.90

Tested by 5

getMethod · 0.64
prepareMethod · 0.64
getMethod · 0.64
getMethod · 0.64
getMethod · 0.64