Attention
This is the documentation for HARP Proxy, actually published as an early preview. Both the software and documentation are a work in progress, and although we already use it on various production servers, they may contain inaccuracies, typographical errors, huge mistakes and empty pages. We work hard to eradicate all mistakes and implement stuff, but it is a long and tedious process. We appreciate your patience and understanding. Of course, any help will be greatly appreciated.
HTTP (harp.http)¶
- class AlreadyHandledHttpResponse[source]¶
Bases:
HttpResponse
- class BaseHttpMessage[source]¶
Bases:
BaseMessage
- property headers: MultiDictProxy¶
- class HttpError[source]¶
Bases:
BaseHttpMessage
- property headers: MultiDictProxy¶
- class HttpRequest[source]¶
Bases:
BaseHttpMessage
- __init__(impl)[source]¶
- Parameters:
impl (HttpRequestBridge)
- async join()[source]¶
Read all chunks from request. We may want to be able to read partial body later, but for now it’s all or nothing. This method does nothing if the body has already been read.
- property body: bytes¶
Returns the previously read body of the request. Raises a RuntimeError if the body has not been read yet, you must await the read() asynchronous method first, which cannot be done here because properties are synchronous, so we let the user explicitely call it before.
- property headers: CIMultiDictProxy¶
- property query: MultiDictProxy¶
Get the query string from the implementation bridge, as a read only proxy.
- class HttpRequestBridge[source]¶
Bases:
Protocol
The HttpRequestBridge protocol defines the methods required by the HttpRequest object for it to attach to a real implementation, such as WSGI, ASGI, …
- __init__(*args, **kwargs)¶
- class HttpRequestSerializer[source]¶
Bases:
BaseHttpMessageSerializer
Serialize an HTTP request object into string representations for different message parts:
summary: the first line of the request message (e.g. “GET / HTTP/1.1”)
headers: the headers of the request message (e.g. “Host: localhost:4080
Connection: keep-alive …”)
body: the body of the request message (e.g. b’{“foo”: “bar”}’)
The main goal of this serializer is to prepare a request message for storage.
- wrapped: HttpRequest¶
- class HttpResponse[source]¶
Bases:
BaseHttpMessage
- property headers: CIMultiDict¶
- class HttpResponseBridge[source]¶
Bases:
Protocol
The HttpResponseBridge protocol defines the necessary methods to actually send an HttpResponse through a real channel.
- __init__(*args, **kwargs)¶
- class JsonHttpResponse[source]¶
Bases:
HttpResponse
- get_serializer_for(message)[source]¶
- Parameters:
message (BaseMessage)
- Return type: