on_redirection Event
Fires when the server suggests a redirect.
Syntax
class HTTPClientRedirectionEventParams(object): @property def old_url() -> str: ... @property def new_url() -> str: ... @new_url.setter def new_url(value) -> None: ... @property def allow_redirection() -> bool: ... @allow_redirection.setter def allow_redirection(value) -> None: ... # In class HTTPClient: @property def on_redirection() -> Callable[[HTTPClientRedirectionEventParams], None]: ... @on_redirection.setter def on_redirection(event_hook: Callable[[HTTPClientRedirectionEventParams], None]) -> None: ...
Remarks
This event is fired when the server suggests a redirection request (typically via a 301 or 302 response). OldURL indicates the 'from' page, and NewURL indicates the 'to' one. The destination page can be altered by the application if needed. Use AllowRedirection to block undesirable redirects.
Generally, this is a notification event: the component handles redirections automatically. Use the MaxRedirections config property to limit the number of redirection hops.