spresso.model.web package

Submodules

spresso.model.web.base module

class Request[source]

Bases: object

Base class defining the interface of a request.

cookies

Retrieve a list of cookies from the header of the request.

Retrieve a specific cookie from the header of the request.

get_param(name, default=None)[source]

Retrieve a parameter from the query string of the request.

header(name, default=None)[source]

Retrieve a header of the request.

method

Returns the HTTP method of the request.

path

Returns the current path portion of the current uri. Used by some grants to determine which action to take.

post_param(name, default=None)[source]

Retrieve a parameter from the body of the request.

class Response[source]

Bases: object

Contains data returned to the requesting user agent.

add_header(header, value)[source]

Add a header to the response.

Parameters:
  • header (str) – The identifier.
  • value (str) – The value.
headers

Return the headers of the response.

Returns:The headers.
Return type:dict

Add a cookie to the response.

Parameters:
  • key (str) – The identifier.
  • value (str) – The value.
  • expires (str) – The expiration date.
  • path (str) – The path.
  • comment (str) – A comment.
  • domain (str) – The domain.
  • max_age (str) – The expiration time in seconds.
  • secure (bool) – Secure flag.
  • version (str) – The version.
  • http_only (bool) – HTTPOnly flag.

spresso.model.web.wsgi module

class WsgiRequest(env)[source]

Bases: spresso.model.web.base.Request

Contains data of the current HTTP request.

cookies

Returns all cookies of the request.

Returns:An empty dictionary or all dictionary containing all cookies.

Returns a specific cookie of the request.

Returns:None or the cookie value.
get_param(name, default=None)[source]

Returns a param of a GET request identified by its name.

Returns:A default value or the parameter.
header(name, default=None)[source]

Returns the value of the HTTP header identified by name.

Returns:A default value or the header.
method

Returns the method of the request.

Returns:The method.
Return type:str
path

Returns the path of the request.

Returns:The path.
Return type:str
post_param(name, default=None)[source]

Returns a param of a POST request identified by its name.

Returns:A default value or the parameter.

Module contents