protocol.http.request
Module¶
HTTP conversation objects.
-
class
wpull.protocol.http.request.
RawRequest
(method=None, resource_path=None, version='HTTP/1.1')[source]¶ Bases:
wpull.protocol.abstract.request.BaseRequest
,wpull.protocol.abstract.request.SerializableMixin
,wpull.protocol.abstract.request.DictableMixin
Represents an HTTP request.
-
method
¶ str
The HTTP method in the status line. For example,
GET
,POST
.
-
resource_path
¶ str
The URL or “path” in the status line.
-
version
¶ str
The HTTP version in the status line. For example,
HTTP/1.0
.
-
fields
¶ -
The fields in the HTTP header.
-
encoding
¶ str
The encoding of the status line.
-
-
class
wpull.protocol.http.request.
Request
(url=None, method='GET', version='HTTP/1.1')[source]¶ Bases:
wpull.protocol.http.request.RawRequest
Represents a higher level of HTTP request.
-
address
¶ tuple
An address tuple suitable for
socket.connect()
.
-
username
¶ str
Username for HTTP authentication.
-
password
¶ str
Password for HTTP authentication.
-
-
class
wpull.protocol.http.request.
Response
(status_code=None, reason=None, version='HTTP/1.1', request=None)[source]¶ Bases:
wpull.protocol.abstract.request.BaseResponse
,wpull.protocol.abstract.request.SerializableMixin
,wpull.protocol.abstract.request.DictableMixin
Represents the HTTP response.
-
status_code
¶ int
The status code in the status line.
-
status_reason
¶ str
The status reason string in the status line.
-
version
¶ str
The HTTP version in the status line. For example,
HTTP/1.1
.
-
fields
¶ -
The fields in the HTTP headers (and trailer, if present).
-
request
¶ The corresponding request.
-
encoding
¶ str
The encoding of the status line.
-
classmethod
parse_status_line
(data)[source]¶ Parse the status line bytes.
Returns: An tuple representing the version, code, and reason. Return type: tuple
-
protocol
¶
-