protocol.http.stream
Module¶
HTML protocol streamers.
-
wpull.protocol.http.stream.
DEFAULT_NO_CONTENT_CODES
= frozenset({100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 204, 304})¶ Status codes where a response body is prohibited.
-
class
wpull.protocol.http.stream.
Stream
(connection, keep_alive=True, ignore_length=False)[source]¶ Bases:
object
HTTP stream reader/writer.
Parameters: - connection (
connection.Connection
) – An established connection. - keep_alive (bool) – If True, use HTTP keep-alive.
- ignore_length (bool) – If True, Content-Length headers will be ignored. When using this option, keep_alive should be False.
-
connection
¶ The underlying connection.
-
connection
-
data_event_dispatcher
¶
-
classmethod
get_read_strategy
(response)[source]¶ Return the appropriate algorithm of reading response.
Returns: chunked
,length
,close
.Return type: str
-
read_body
(request, response, file=None, raw=False)[source]¶ Read the response’s content body.
Coroutine.
- connection (
-
wpull.protocol.http.stream.
is_no_body
(request, response, no_content_codes=frozenset({100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154, 155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167, 168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180, 181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193, 194, 195, 196, 197, 198, 199, 204, 304}))[source]¶ Return whether a content body is not expected.