Website.redirect_response#

Website.redirect_response(url, code=302, Response=None)#

Use it with Page.on_url_request to redirect the user to another page.

Page.on_url_request is called when the user makes an HTTP request to the page. If you want to redirect the user to another page, define a function then use this method as the return value of a function. Then add the function to Page.on_url_request and set display_return_value as True.

Examples

>>> def redirect_function():
...     return app.redirect_response("/another-page-url")
>>> home_page.on_url_request(redirect_function, display_return_value=True)
Parameters:
  • url (str) – The URL of the page that the user will be redirected to.

  • code (int, default=302) –

  • response (flask.Response, default=None) –