class documentation

class HTTPPageGetter(http.HTTPClient): (source)

Known subclasses: twisted.web.client.HTTPPageDownloader

View In Hierarchy

Gets a resource via HTTP, then quits.

Typically used with HTTPClientFactory. Note that this class does not, by itself, do anything with the response. If you want to download a resource into a file, use HTTPPageDownloader instead.

Method connection​Lost When the connection used to issue the HTTP request is closed, notify the factory if we have not already, so it can produce a result.
Method connection​Made Called when a connection is made.
Method handle​End​Headers Called when all headers have been received.
Method handle​Header Called every time a header is received. Stores the header information as key-value pairs in the headers attribute.
Method handle​Response Undocumented
Method handle​Status Handle the HTTP status line.
Method handle​Status_200 Undocumented
Method handle​Status_301 Undocumented
Method handle​Status_302 Undocumented
Method handle​Status_303 Undocumented
Method handle​Status​Default Undocumented
Method timeout Undocumented
Class Variable follow​Redirect Undocumented
Class Variable handle​Status_201 Undocumented
Class Variable handle​Status_202 Undocumented
Instance Variable failed Undocumented
Instance Variable headers Undocumented
Instance Variable message Undocumented
Instance Variable quiet​Loss Undocumented
Instance Variable status Undocumented
Instance Variable version Undocumented
Class Variable _special​Headers Undocumented
Instance Variable _completely​Done A boolean indicating whether any further requests are necessary after this one completes in order to provide a result to self.factory.deferred. If it is False, then a redirect is going to be followed. Otherwise, this protocol's connection is the last one before firing the result Deferred. This is used to make sure the result Deferred is only fired after the connection is cleaned up.

Inherited from HTTPClient:

Method end​Headers Undocumented
Method extract​Header Given a complete HTTP header, extract the field name and value and process the header.
Method handle​Response​End The response has been completely received.
Method handle​Response​Part Undocumented
Method line​Received Parse the status line and headers for an HTTP request.
Method raw​Data​Received Override this for when raw data is received.
Method send​Command Undocumented
Method send​Header Undocumented
Instance Variable first​Line Are we waiting for the first header line?
Instance Variable length The length of the request body in bytes.
Instance Variable __buffer The buffer that stores the response to the HTTP request.
Instance Variable _header Part or all of an HTTP request header.

Inherited from LineReceiver (via HTTPClient):

Method clear​Line​Buffer Clear buffered data.
Method data​Received Protocol.dataReceived. Translates bytes into lines, and calls lineReceived (or rawDataReceived, depending on mode.)
Method line​Length​Exceeded Called when the maximum line length has been reached. Override if it needs to be dealt with in some special way.
Method send​Line Sends a line to the other end of the connection.
Method set​Line​Mode Sets the line-mode of this receiver.
Method set​Raw​Mode Sets the raw mode of this receiver. Further data received will be sent to rawDataReceived rather than lineReceived.
Constant MAX​_LENGTH The maximum length of a line to allow (If a sent line is longer than this, the connection is dropped). Default is 16384.
Class Variable delimiter The line-ending delimiter to use. By default this is b'\r\n'.
Instance Variable line​_mode Undocumented
Instance Variable _buffer Undocumented
Instance Variable _busy​Receiving Undocumented

Inherited from Protocol (via HTTPClient, LineReceiver):

Method log​Prefix Return a prefix matching the class name, to identify log messages related to this protocol instance.
Class Variable factory Undocumented

Inherited from BaseProtocol (via HTTPClient, LineReceiver, Protocol):

Method make​Connection Make a connection to a transport and a server.
Instance Variable connected Undocumented
Instance Variable transport Undocumented

Inherited from _PauseableMixin (via HTTPClient, LineReceiver):

Method pause​Producing Undocumented
Method resume​Producing Undocumented
Method stop​Producing Undocumented
Instance Variable paused Undocumented
def connectionLost(self, reason): (source)
When the connection used to issue the HTTP request is closed, notify the factory if we have not already, so it can produce a result.
def connectionMade(self): (source)

Called when a connection is made.

This may be considered the initializer of the protocol, because it is called when the connection is completed. For clients, this is called once the connection to the server has been established; for servers, this is called after an accept() call stops blocking and a socket has been received. If you need to send any greeting or initial message, do it here.

def handleEndHeaders(self): (source)
Called when all headers have been received.
def handleHeader(self, key, value): (source)
Called every time a header is received. Stores the header information as key-value pairs in the headers attribute.
Parameters
key:strAn HTTP header field name.
value:strAn HTTP header field value.
def handleResponse(self, response): (source)

Undocumented

def handleStatus(self, version, status, message): (source)
Handle the HTTP status line.
Parameters
version:bytesThe HTTP version.
status:bytesThe HTTP status code, an integer represented as a bytestring.
message:bytesThe HTTP status message.
def handleStatus_200(self): (source)

Undocumented

def handleStatus_301(self): (source)

Undocumented

def handleStatus_302(self): (source)

Undocumented

def handleStatus_303(self): (source)

Undocumented

def handleStatusDefault(self): (source)

Undocumented

def timeout(self): (source)

Undocumented

followRedirect: bool = (source)

Undocumented

handleStatus_201 = (source)

Undocumented

handleStatus_202 = (source)

Undocumented

failed: int = (source)

Undocumented

headers: dict = (source)

Undocumented

message = (source)

Undocumented

quietLoss: bool = (source)

Undocumented

status = (source)

Undocumented

version = (source)

Undocumented

_specialHeaders: set[bytes] = (source)

Undocumented

_completelyDone: bool = (source)
A boolean indicating whether any further requests are necessary after this one completes in order to provide a result to self.factory.deferred. If it is False, then a redirect is going to be followed. Otherwise, this protocol's connection is the last one before firing the result Deferred. This is used to make sure the result Deferred is only fired after the connection is cleaned up.