twisted.web.client.Agent(_AgentBase) class documentationtwisted.web.client
(View In Hierarchy)
Implements interfaces: twisted.web.iweb.IAgent
Agent is a very
basic HTTP client.  It supports HTTP and HTTPS scheme 
URIs.
| Present Since | 9.0 | |
| Method | __init__ | Create an Agent. | 
| Class Method | usingEndpointFactory | Create a new Agentthat will use 
the endpoint factory to figure out how to connect to the server. | 
| Method | request | Issue a request to the server indicated by the given uri. | 
| Instance Variable | _pool | An HTTPConnectionPoolinstance. | 
| Instance Variable | _endpointFactory | The IAgentEndpointFactorywhich will be used to create endpoints for outgoing connections. | 
| Method | _init | Initialize a new Agent. | 
| Method | _getEndpoint | Get an endpoint for the given URI, using self._endpointFactory. | 
Inherited from _AgentBase:
| Instance Variable | _reactor | The IReactorTimeimplementation which will be used by the 
pool, and perhaps by subclasses as well. | 
| 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. | 
IAgentEndpointFactory
which will be used to create endpoints for outgoing connections.
  Create an Agent.
| Parameters | reactor | A reactor for this Agentto place 
outgoing connections. (type: seeHostnameEndpoint.__init__for acceptable reactor types.) | 
| contextFactory | A factory for TLS contexts, to control the verification parameters of 
OpenSSL.  The default is to use a BrowserLikePolicyForHTTPS,
so unless you have special requirements you can leave this as-is. (type:IPolicyForHTTPS.) | |
| connectTimeout | The amount of time that this Agentwill wait for 
the peer to accept a connection. (type:float) | |
| bindAddress | The local address for client sockets to bind to. (type: bytes) | |
| pool | An HTTPConnectionPoolinstance, orNone,
in which case a non-persistentHTTPConnectionPoolinstance will be created. (type:HTTPConnectionPool) | 
Create a new Agent that will use 
the endpoint factory to figure out how to connect to the server.
| Parameters | reactor | A reactor for this Agentto place 
outgoing connections. (type: seeHostnameEndpoint.__init__for acceptable reactor types.) | 
| endpointFactory | Used to construct endpoints which the HTTP client will connect with. (type: an IAgentEndpointFactoryprovider.) | |
| pool | An HTTPConnectionPoolinstance, orNone,
in which case a non-persistentHTTPConnectionPoolinstance will be created. (type:HTTPConnectionPool) | |
| Returns | A new Agent. | |
Initialize a new Agent.
| Parameters | reactor | A reactor for this Agentto place 
outgoing connections. (type: seeHostnameEndpoint.__init__for acceptable reactor types.) | 
| endpointFactory | Used to construct endpoints which the HTTP client will connect with. (type: an IAgentEndpointFactoryprovider.) | |
| pool | An HTTPConnectionPoolinstance, orNone,
in which case a non-persistentHTTPConnectionPoolinstance will be created. (type:HTTPConnectionPool) | |
| Returns | A new Agent. | |
Get an endpoint for the given URI, using 
self._endpointFactory.
| Parameters | uri | The URI of the request. (type: URI) | 
| Returns | An endpoint which can be used to connect to given address. | |
Issue a request to the server indicated by the given 
uri.
An existing connection from the connection pool may be used or a new one may be created.
HTTP and HTTPS schemes are supported in 
uri.
| See Also | twisted.web.iweb.IAgent.request | |