twisted.web.client.Response class documentationtwisted.web.client
(View In Hierarchy)
Implements interfaces: twisted.web.iweb.IResponse
| Method | __init__ | |
| Method | setPreviousResponse | Set the reference to the previous IResponse. | 
| Method | deliverBody | Dispatch the given IProtocoldepending of the current state of the response. | 
| Instance Variable | _transport | See __init__. | 
| Instance Variable | _bodyProtocol | The IProtocolprovider to which the body is delivered.Nonebefore one has been registered withdeliverBody. | 
| Instance Variable | _bodyBuffer | A listof the strings passed tobodyDataReceivedbeforedeliverBodyis called.Noneafterwards. | 
| Instance Variable | _state | Indicates what state this Responseinstance 
is in, particularly with respect to delivering bytes from the response body
to an application-supplied protocol object.  This may be one of'INITIAL','CONNECTED','DEFERRED_CLOSE', or'FINISHED', with the 
following meanings:
 str) | 
| Class Method | _construct | Private constructor. | 
| Method | _deliverBody_INITIAL | Deliver any buffered data to protocoland prepare to 
deliver any future data to it.  Move to the'CONNECTED'state. | 
| Method | _deliverBody_CONNECTED | It is invalid to attempt to deliver data to a protocol when it is already being delivered to another protocol. | 
| Method | _deliverBody_DEFERRED_CLOSE | Deliver any buffered data to protocoland then disconnect 
the protocol.  Move to the'FINISHED'state. | 
| Method | _deliverBody_FINISHED | It is invalid to attempt to deliver data to a protocol after the response body has been delivered to another protocol. | 
| Method | _bodyDataReceived | Called by HTTPClientParser with chunks of data from the response body. They will be buffered or delivered to the protocol passed to deliverBody. | 
| Method | _bodyDataReceived_INITIAL | Buffer any data received for later delivery to a protocol passed to deliverBody. | 
| Method | _bodyDataReceived_CONNECTED | Deliver any data received to the protocol to which this Responseis 
connected. | 
| Method | _bodyDataReceived_DEFERRED_CLOSE | It is invalid for data to be delivered after it has been indicated that the response body has been completely delivered. | 
| Method | _bodyDataReceived_FINISHED | It is invalid for data to be delivered after the response body has been delivered to a protocol. | 
| Method | _bodyDataFinished | Called by HTTPClientParser when no more body data is available. If the optional reason is supplied, this indicates a problem or potential problem receiving all of the response body. | 
| Method | _bodyDataFinished_INITIAL | Move to the 'DEFERRED_CLOSE'state to wait for a protocol 
to which to deliver the response body. | 
| Method | _bodyDataFinished_CONNECTED | Disconnect the protocol and move to the 'FINISHED'state. | 
| Method | _bodyDataFinished_DEFERRED_CLOSE | It is invalid to attempt to notify the Responseof the 
end of the response body data more than once. | 
| Method | _bodyDataFinished_FINISHED | It is invalid to attempt to notify the Responseof the 
end of the response body data more than once. | 
Response instance 
is in, particularly with respect to delivering bytes from the response body
to an application-supplied protocol object.  This may be one of 
'INITIAL', 'CONNECTED', 
'DEFERRED_CLOSE', or 'FINISHED', with the 
following meanings:
Response 
    objects start in.  No protocol has yet been provided and the underlying
    transport may still have bytes to deliver to it.
  Response moves
    to this state.  Data is buffered and waiting for a protocol to be 
    delivered to.
  Response moves
    to this state.  Any buffered data is delivered and any data which 
    arrives from the transport subsequently is given directly to the 
    protocol.
  Response moves
    to this state after delivering all buffered data to the protocol.  
    Otherwise, if the Response is in
    the CONNECTED state, if the transport indicates there is no more data, 
    the Response moves
    to this state.  Nothing else can happen once the Response is in
    this state.
  str)
  | Parameters | version | HTTP version components protocol, major, minor. E.g. (b'HTTP', 1, 
1)to meanb'HTTP/1.1'. | 
| code | HTTP status code. (type: int) | |
| phrase | HTTP reason phrase, intended to give a short description of the HTTP status code. | |
| headers | HTTP response headers. (type: twisted.web.http_headers.Headers) | |
| _transport | The transport which is delivering this response. | 
Set the reference to the previous IResponse.
The value of the previous response can be read via IResponse.previousResponse.
Dispatch the given IProtocol
depending of the current state of the response.
Deliver any buffered data to protocol and prepare to 
deliver any future data to it.  Move to the 'CONNECTED' 
state.
It is invalid to attempt to deliver data to a protocol when it is already being delivered to another protocol.
Deliver any buffered data to protocol and then disconnect 
the protocol.  Move to the 'FINISHED' state.
It is invalid to attempt to deliver data to a protocol after the response body has been delivered to another protocol.
Called by HTTPClientParser with chunks of data from the response body. They will be buffered or delivered to the protocol passed to deliverBody.
Buffer any data received for later delivery to a protocol passed to 
deliverBody.
Little or no data should be buffered by this method, since the transport has been paused and will not be resumed until a protocol is supplied.
Deliver any data received to the protocol to which this Response is 
connected.
It is invalid for data to be delivered after it has been indicated that the response body has been completely delivered.
It is invalid for data to be delivered after the response body has been delivered to a protocol.
Called by HTTPClientParser when no more body data is available. If the optional reason is supplied, this indicates a problem or potential problem receiving all of the response body.
Move to the 'DEFERRED_CLOSE' state to wait for a protocol 
to which to deliver the response body.
Disconnect the protocol and move to the 'FINISHED' 
state.
It is invalid to attempt to notify the Response of the 
end of the response body data more than once.
It is invalid to attempt to notify the Response of the 
end of the response body data more than once.