class documentation

class HTTPClientParser(HTTPParser): (source)

View In Hierarchy

An HTTP parser which only handles HTTP responses.
Method __init__ Undocumented
Method all​Headers​Received Figure out how long the response body is going to be by examining headers and stuff.
Method connection​Lost Called when the connection is shut down.
Method data​Received Override so that we know if any response has been received.
Method is​Connection​Control​Header Content-Length in the response to a HEAD request is an entity header, not a connection control header.
Method parse​Version Parse version strings of the form Protocol '/' Major '.' Minor. E.g. b'HTTP/1.1'. Returns (protocol, major, minor). Will raise ValueError on bad syntax.
Method status​Received Parse the status line into its components and create a response object to keep track of this response's state.
Constant NO​_BODY​_CODES A set of response codes which MUST NOT have a body.
Class Variable body​Decoder Undocumented
Instance Variable finisher A callable to invoke when this response is fully parsed.
Instance Variable request The request with which the expected response is associated.
Instance Variable response Undocumented
Instance Variable state Undocumented
Method _finished Called to indicate that an entire response has been received. No more bytes will be interpreted by this HTTPClientParser. Extra bytes are passed up and the state of this HTTPClientParser is set to DONE.
Class Variable _log Undocumented
Class Variable _transfer​Decoders Undocumented
Instance Variable _ever​Received​Data True if any bytes have been received.
Instance Variable _response​Deferred A Deferred which will be called back with the response when all headers in the response have been received. Thereafter, None.

Inherited from HTTPParser:

Method connection​Made Called when a connection is made.
Method header​Received Store the given header in self.headers.
Method line​Received Handle one line from a response.
Method raw​Data​Received Pass data from the message body to the body decoder object.
Method switch​To​Body​Mode Switch to body parsing mode - interpret any more bytes delivered as part of the message body and deliver them to the given decoder.
Constant CONNECTION​_CONTROL​_HEADERS Undocumented
Class Variable delimiter Undocumented
Instance Variable conn​Headers Undocumented
Instance Variable headers All of the non-connection control message headers yet received.
Instance Variable _partial​Header None or a list of the lines of a multiline header while that header is being received.

Inherited from LineReceiver (via HTTPParser):

Method clear​Line​Buffer Clear buffered data.
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.
Instance Variable line​_mode Undocumented
Instance Variable _buffer Undocumented
Instance Variable _busy​Receiving Undocumented

Inherited from Protocol (via HTTPParser, 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 HTTPParser, 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 HTTPParser, LineReceiver):

Method pause​Producing Undocumented
Method resume​Producing Undocumented
Method stop​Producing Undocumented
Instance Variable paused Undocumented
def __init__(self, request, finisher): (source)

Undocumented

def allHeadersReceived(self): (source)
Figure out how long the response body is going to be by examining headers and stuff.
def connectionLost(self, reason): (source)

Called when the connection is shut down.

Clear any circular references here, and any external references to this Protocol. The connection has been closed.

Parameters
reason:twisted.python.failure.FailureUndocumented
def dataReceived(self, data): (source)
Override so that we know if any response has been received.
def isConnectionControlHeader(self, name): (source)
Content-Length in the response to a HEAD request is an entity header, not a connection control header.
def parseVersion(self, strversion): (source)
Parse version strings of the form Protocol '/' Major '.' Minor. E.g. b'HTTP/1.1'. Returns (protocol, major, minor). Will raise ValueError on bad syntax.
def statusReceived(self, status): (source)
Parse the status line into its components and create a response object to keep track of this response's state.
NO_BODY_CODES = (source)
A set of response codes which MUST NOT have a body.
Value
set([NO_CONTENT, NOT_MODIFIED])
finisher = (source)
A callable to invoke when this response is fully parsed.
request: Request = (source)
The request with which the expected response is associated.
response = (source)

Undocumented

def _finished(self, rest): (source)
Called to indicate that an entire response has been received. No more bytes will be interpreted by this HTTPClientParser. Extra bytes are passed up and the state of this HTTPClientParser is set to DONE.
Parameters
restA bytes giving any extra bytes delivered to this HTTPClientParser which are not part of the response being parsed.
_log = (source)

Undocumented

_transferDecoders = (source)

Undocumented

_everReceivedData: bool = (source)
True if any bytes have been received.
_responseDeferred = (source)
A Deferred which will be called back with the response when all headers in the response have been received. Thereafter, None.