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.

harp.http.requests

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 basic_auth: tuple[str, str] | None

Parse and returns basic auth from headers.

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 cookies: dict

Parse and returns cookies from headers.

created_at: datetime
property headers: CIMultiDictProxy
kind: str = 'request'
property method: str

Get the HTTP method from the implementation bridge.

property path: str

Get the HTTP path from the implementation bridge.

property query: MultiDictProxy

Get the query string from the implementation bridge, as a read only proxy.

property server_ipaddr: str

Get the server IP address from the implementation bridge.

property server_port: int

Get the server port from the implementation bridge.

class WrappedHttpRequest[source]

Bases: HttpRequest

__init__(wrapped, /)[source]
Parameters:

wrapped (HttpRequest)

property headers: MutableMapping