18.6.4 HTTPRedirectHandler Objects

##
18.6.4 HTTPRedirectHandler Objects

Note: Some HTTP redirections require action from this module's client code. If this is the case, `HTTPError` is raised. See RFC 2616 for details of the precise meanings of the various redirection codes.

`redirect_request`( | req, fp, code, msg, hdrs)

  Return a `Request` or `None` in response to a redirect. This is called by the default implementations of the `http_error_30*()` methods when a redirection is received from the server. If a redirection should take place, return a new `Request` to allow `http_error_30*()` to perform the redirect. Otherwise, raise `HTTPError` if no other handler should try to handle this URL, or return `None` if you can't but another handler might.

  Note: The default implementation of this method does not strictly follow RFC 2616, which says that 301 and 302 responses to `POST` requests must not be automatically redirected without confirmation by the user. In reality, browsers do allow automatic redirection of these responses, changing the POST to a `GET`, and the default implementation reproduces this behavior.

`http_error_301`( | req, fp, code, msg, hdrs)

  Redirect to the `Location:` URL. This method is called by the parent `OpenerDirector` when getting an HTTP `moved permanently' response.

`http_error_302`( | req, fp, code, msg, hdrs)

  The same as `http_error_301()`, but called for the `found' response.

`http_error_303`( | req, fp, code, msg, hdrs)

  The same as `http_error_301()`, but called for the `see other' response.

`http_error_307`( | req, fp, code, msg, hdrs)

  The same as `http_error_301()`, but called for the `temporary redirect' response.