httpq#
from httpq import Request, Response, state
httpq
implementation.
- class Headers[source]#
Container for HTTP headers.
- property raw#
The raw headers.
- Return type:
bytes
- class Message[source]#
- __init__(protocol, headers, body)[source]#
Initializes an HTTP message.
- Parameters:
protocol (
Union
[bytes
,str
,int
,bool
,None
,Item
]) – The protocol of the HTTP message.headers (
Union
[Headers
,dict
]) – The headers of the HTTP message.body (
Union
[bytes
,str
,int
,bool
,None
,Item
]) – The body of the HTTP message.
- feed(msg)[source]#
Adds chuncks of the message to the internal buffer.
- Parameters:
msg (
bytes
) – The message to add to the internal buffer.- Return type:
- classmethod parse(msg)[source]#
Parses a complete HTTP message.
- Parameters:
msg (
bytes
) – The message to parse.- Return type:
- property raw#
Returns the raw (bytes) HTTP message.
- Return type:
bytes
- class Request[source]#
- __init__(method, target, protocol, headers, body)[source]#
Initializes an HTTP request.
- Parameters:
method (
Union
[bytes
,str
,int
,bool
,None
,Item
]) – The method of the HTTP request.target (
Union
[bytes
,str
,int
,bool
,None
,Item
]) – The target of the HTTP request.protocol (
Union
[bytes
,str
,int
,bool
,None
,Item
]) – The protocol of the HTTP request.headers (
Union
[Headers
,dict
]) – The headers of the HTTP request.body (
Union
[bytes
,str
,int
,bool
,None
,Item
]) – The body of the HTTP request.
- class Response[source]#
- __init__(protocol, status, reason, headers, body)[source]#
Initializes an HTTP response.
- Parameters:
protocol (
Union
[bytes
,str
,int
,bool
,None
,Item
]) – The protocol of the HTTP response.status (
Union
[bytes
,str
,int
,bool
,None
,Item
]) – The status of the HTTP response.reason (
Union
[bytes
,str
,int
,bool
,None
,Item
]) – The reason of the HTTP response.headers (
Union
[Headers
,dict
]) – The headers of the HTTP response.body (
Union
[bytes
,str
,int
,bool
,None
,Item
]) – The body of the HTTP response.