# Class e.p.h.h.ElisaHttpClient(Loggable):

Part of elisa.plugins.http_client.http_client View In Hierarchy

Known subclasses: elisa.plugins.http_client.http_client.ElisaAdvancedHttpClient

`twisted.web2` based HTTP client.

It connects to a given server and optionally supports request pipelining. It does not support HTTP redirections.

Line # | Kind | Name | Docs
--- | --- | --- | ---
176 | Method | __init__ | Constructor.
214 | Method | request | Send an HTTP request.
228 | Method | request_full | Send an HTTP request.
243 | Method | close | Close an open HTTP connection.
267 | Method | is_busy | Test whether the client is busy processing requests.
345 | Method | connectionFailed | Callback invoked by the HTTP client factory when the connection fails.
357 | Method | connectionLost | Callback invoked by the HTTP client factory when losing the connection.
392 | Method | connectionLostForever | Callback invoked by the HTTP client factory when the connection is lost
414 | Method | connectionMade | Callback invoked by the HTTP client protocol when the connection is
430 | Method | requestWriteFinished | Callback invoked by the HTTP client protocol when a request has been

def __init__(self, host, port=80, pipeline=True):
overrides elisa.core.log.Loggable.__init__
overridden in elisa.plugins.http_client.http_client.ElisaAdvancedHttpClient
Constructor.

Parameters | host | hostname or IP address of the server (type: `str` )
| port | TCP port on which the server listens (type: `int` )
| pipeline | whether the client should pipeline requests (type: `bool` )

def request(self, uri, method='GET'):
Send an HTTP request.

Parameters | uri | the URI of the resource to request (type: `str` )
| method | the HTTP method of the request (default: GET) (type: `str` )
Returns | a deferred triggered when the request is executed (type: `elisa.core.utils.cancellable_defer.CancellableDeferred` )

def request_full(self, request):
Send an HTTP request.

Parameters | request | request to submit (type: `elisa.plugins.http_client.extern.client_http.ClientRequest` )
Returns | a deferred triggered when the request is executed (type: `elisa.core.utils.cancellable_defer.CancellableDeferred` )

def close(self):
Close an open HTTP connection.

Returns | a deferred triggered when the connection is closed (type: `twisted.internet.defer.Deferred` )

def is_busy(self):
Test whether the client is busy processing requests.

Returns | `True` if the client is busy, `False` otherwise (type: `bool` )

def connectionFailed(self, connector, reason):
Callback invoked by the HTTP client factory when the connection fails.

Parameters | connector | the TCP connector (type: `twisted.internet.tcp.Connector` )
| reason | the reason of the connection failure (type: `twisted.python.failure.Failure` )

def connectionLost(self, connector, reason):
Callback invoked by the HTTP client factory when losing the connection.

Parameters | connector | the TCP connector (type: `twisted.internet.tcp.Connector` )
| reason | the reason of the connection loss (type: `twisted.python.failure.Failure` )
Returns | False if the connection has been closed, True otherwise. (type: `bool` )

def connectionLostForever(self, connector, reason):
Callback invoked by the HTTP client factory when the connection is lost forever. This happens when the maximum number of connection retries is reached.

Parameters | connector | the TCP connector (type: `twisted.internet.tcp.Connector` )
| reason | the reason of the last connection loss (type: `twisted.python.failure.Failure` )

def connectionMade(self, protocol):
Callback invoked by the HTTP client protocol when the connection is established.

Parameters | protocol | the HTTP client protocol (type: `ElisaHttpClientProtocol` )

def requestWriteFinished(self, req):
Callback invoked by the HTTP client protocol when a request has been fully written.

Parameters | req | the channel request that has been written (type: `http_client.extern.client_http.HTTPClientChannelRequest` )