Go to the latest version of this document.
search in docstrings

Search bar offers the following options:

- Term presence. The below example searches for documents that must contain “foo”, might contain “bar” and must not contain “baz”: `+foo bar -baz`
- Wildcards. The below example searches for documents with words beginning with “foo”: `foo*`
- Search in specific fields. The following search matches all objects in "twisted.mail" that matches “search”: `+qname:twisted.mail.* +search`

  Possible fields: 'name', 'qname' (fully qualified name), 'docstring', and 'kind'. Last two fields are only applicable if "search in docstrings" is enabled.

- Fuzzy matches. The following search matches all documents that have a word within 1 edit distance of “foo”: `foo~1`

Results provided by Lunr.js

# ``twisted`.`web`.`client`.`RedirectAgent``

class documentation

`class RedirectAgent: (source)`

Known subclasses: `twisted.web.client.BrowserLikeRedirectAgent`

Implements interfaces: `twisted.web.iweb.IAgent`

View In Hierarchy

An `Agent` wrapper which handles HTTP redirects.

The implementation is rather strict: 301 and 302 behaves like 307, not redirecting automatically on methods different from GET and HEAD.

See `BrowserLikeRedirectAgent` for a redirecting Agent that behaves more like a web browser.

Parameters
redirectLimit | The maximum number of times the agent is allowed to follow redirects before failing with a `error.InfiniteRedirection`.
sensitiveHeaderNames | An iterable of `bytes` enumerating the names of headers that must not be transmitted when redirecting to a different origins. These will be consulted in addition to the protocol-specified set of headers that contain sensitive information.
Present Since
11.1

Method | `__init__` | Undocumented
Method | `request` | Send a client request following HTTP redirects.
Method | `_handleRedirect` | Handle a redirect response, checking the number of redirects already followed, and extracting the location header fields.
Method | `_handleResponse` | Handle the response, making another request if it indicates a redirect.
Method | `_resolveLocation` | Resolve the redirect location against the request URI.
Class Variable | `_redirectResponses` | A `list` of HTTP status codes to be redirected for GET and HEAD methods.
Class Variable | `_seeOtherResponses` | A `list` of HTTP status codes to be redirected for any method and the method altered to GET.
Instance Variable | `_agent` | Undocumented
Instance Variable | `_redirectLimit` | Undocumented
Instance Variable | `_sensitiveHeaderNames` | Undocumented

def __init__(self, agent, redirectLimit=20, sensitiveHeaderNames=()): (source)

Undocumented

Parameters
agent:`IAgent` | Undocumented
redirectLimit:`int` | Undocumented
sensitiveHeaderNames:`Iterable[bytes]` | Undocumented

def request(self, method, uri, headers=None, bodyProducer=None): (source)
from `twisted.web.iweb.IAgent`

Send a client request following HTTP redirects.

See Also
`Agent.request`.

def _handleRedirect(self, response, method, uri, headers, redirectCount): (source)

Handle a redirect response, checking the number of redirects already followed, and extracting the location header fields.

def _handleResponse(self, response, method, uri, headers, redirectCount): (source)

Handle the response, making another request if it indicates a redirect.

def _resolveLocation(self, requestURI, location): (source)

Resolve the redirect location against the request URI.

Parameters
requestURI:`bytes` | The request URI.
location:`bytes` | The redirect location.
Returns
`bytes` | Final resolved URI.

_redirectResponses = (source)
overridden in `twisted.web.client.BrowserLikeRedirectAgent`

A `list` of HTTP status codes to be redirected for GET and HEAD methods.

_seeOtherResponses = (source)
overridden in `twisted.web.client.BrowserLikeRedirectAgent`

A `list` of HTTP status codes to be redirected for any method and the method altered to GET.

_agent = (source)

Undocumented

_redirectLimit = (source)

Undocumented

_sensitiveHeaderNames = (source)

Undocumented