Part of twisted.web.client View Source View In Hierarchy
Agent is a very
basic HTTP client. It supports HTTP and HTTPS scheme URIs
(but performs no certificate checking by default). It does not support
persistent connections.
| Instance Variables | _reactor | The IReactorTCP and IReactorSSL implementation
which will be used to set up connections over which to issue requests.
|
| _contextFactory | A web context factory which will be used to create SSL context objects for any SSL connections the agent needs to make. | |
| Present Since | 9.0 | |
| Method | __init__ | Undocumented |
| Method | request | Issue a new request. |
| Method | _wrapContextFactory | Create and return a normal context factory wrapped around
self._contextFactory in such a way that
self._contextFactory will have the host and port information
passed to it.
|
| Method | _connect | Connect to the given host and port, using a transport selected based on scheme. |
| Method | _computeHostValue | Compute the string to use for the value of the Host header, based on the given scheme, host name, and port number. |
self._contextFactory in such a way that
self._contextFactory will have the host and port information
passed to it.
| Parameters | host | A str giving the hostname which will be connected to in
order to issue a request.
|
| port | An int giving the port number the connection will be
on.
| |
| Returns | A context factory suitable to be passed to
reactor.connectSSL.
| |
| Parameters | scheme | A string like 'http' or 'https' (the only two
supported values) to use to determine how to establish the connection.
|
| host | A str giving the hostname which will be connected to in
order to issue a request.
| |
| port | An int giving the port number the connection will be
on.
| |
| Returns | A Deferred which
fires with a connected instance of self._protocol.
| |
| Parameters | method | The request method to send.
(type: str
) |
| uri | The request URI send.
(type: str
) | |
| headers | The request headers to send. If no Host header is included, one
will be added based on the request URI.
(type: Headers
) | |
| bodyProducer | An object which will produce the request body or, if the request body is
to be empty, None.
(type: IBodyProducer
provider
) | |
| Returns | A Deferred which
fires with the result of the request (a Response
instance), or fails if there is a problem setting up a connection over
which to issue the request. It may also fail with SchemeNotSupported
if the scheme of the given URI is not supported.
(type: Deferred
) | |