t.w.c.Agent(_AgentBase) : class documentation

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).
ParameterspoolA HTTPConnectionPool instance, or None, in which case a non-persistent HTTPConnectionPool instance will be created.
Present Since9.0
Method __init__ Undocumented
Method request Issue a new request.
Instance Variable _contextFactory A web context factory which will be used to create SSL context objects for any SSL connections the agent needs to make.
Instance Variable _connectTimeout If not None, the timeout passed to connectTCP or connectSSL for specifying the connection timeout.
Instance Variable _bindAddress If not None, the address passed to connectTCP or connectSSL for specifying the local address to bind to.
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 _getEndpoint Get an endpoint for the given host and port, using a transport selected based on scheme.

Inherited from _AgentBase:

Instance Variable _reactor The IReactorTime implementation which will be used by the pool, and perhaps by subclasses as well.
Instance Variable _pool The HTTPConnectionPool used to manage HTTP connections.
Method _computeHostValue Compute the string to use for the value of the Host header, based on the given scheme, host name, and port number.
Method _requestWithEndpoint Issue a new request, given the endpoint and the path sent as part of the request.
_contextFactory =
A web context factory which will be used to create SSL context objects for any SSL connections the agent needs to make.
_connectTimeout =
If not None, the timeout passed to connectTCP or connectSSL for specifying the connection timeout.
_bindAddress =
If not None, the address passed to connectTCP or connectSSL for specifying the local address to bind to.
def __init__(self, reactor, contextFactory=WebClientContextFactory(), connectTimeout=None, bindAddress=None, pool=None): (source)
Undocumented
def _wrapContextFactory(self, host, port): (source)
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.
ParametershostA str giving the hostname which will be connected to in order to issue a request.
portAn int giving the port number the connection will be on.
ReturnsA context factory suitable to be passed to reactor.connectSSL.
def _getEndpoint(self, scheme, host, port): (source)
Get an endpoint for the given host and port, using a transport selected based on scheme.
ParametersschemeA string like 'http' or 'https' (the only two supported values) to use to determine how to establish the connection.
hostA str giving the hostname which will be connected to in order to issue a request.
portAn int giving the port number the connection will be on.
ReturnsAn endpoint which can be used to connect to given address.
def request(self, method, uri, headers=None, bodyProducer=None): (source)
Issue a new request.
ParametersmethodThe request method to send. (type: str)
uriThe request URI send. (type: str)
headersThe request headers to send. If no Host header is included, one will be added based on the request URI. (type: Headers)
bodyProducerAn object which will produce the request body or, if the request body is to be empty, None. (type: IBodyProducer provider)
ReturnsA Deferred which fires with the result of the request (a twisted.web.iweb.IResponse provider), 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)
API Documentation for Twisted, generated by pydoctor at 2012-06-04 17:20:01.