Request

class eynnyd.abstract_request.AbstractRequest[source]

The expected interface for a request.

If you want to build your own request object it needs to meet the requirements set out in this class.

abstract property http_method

The HTTP method used for the request. This gets matched against the handler routes and must be an exact match.

Returns

a string like: “GET”, “PUT”, “POST”, “DELETE”, etc.

abstract property request_uri

The request uri encapsulates the scheme, host, port, path, and query.

Returns

An Eynnyd RequestURI object with properties for scheme, host, port, path, and query

abstract property forwarded_request_uri

The request uri but using forwarded info.

Returns

An Eynnyd RequestURI object with properties for scheme, host, port, path, and query

abstract property headers

The HTTP headers from the request

Returns

A dictionary of header names to header values

abstract property client_ip_address

The ip address of the remote user

Returns

a string ip address

abstract property cookies

The cookies from the request

Returns

A dictionary of cookie name to Eynnyd Cookie objects with name and value properties

abstract property query_parameters

The query part of the request

Returns

a dictionary of parameter names to lists of parameter values

abstract property path_parameters

The parameters set in the path of request matching against pattern matching path parameters.

Returns

A dictionary of path variable name to request path value.

abstract property byte_body

The raw request body

Returns

The body of the request left encoded as bytes.

abstract property utf8_body

The encoded request body

Returns

The request body after being encoded to utf-8