circuits.web.utils module

Utilities

This module implements utility functions.

circuits.web.utils.is_unix_socket(path)
circuits.web.utils.average(xs)
circuits.web.utils.variance(xs)
circuits.web.utils.stddev(xs)
circuits.web.utils.parse_body(request, response, params)
circuits.web.utils.parse_qs(query_string) dict

Build a params dictionary from a query_string. If keep_blank_values is True (the default), keep values that are blank.

circuits.web.utils.dictform(form)
circuits.web.utils.compress(body, compress_level)

Compress ‘body’ at the given compress_level.

circuits.web.utils.get_ranges(headervalue, content_length)

Return a list of (start, stop) indices from a Range header, or None.

Each (start, stop) tuple will be composed of two ints, which are suitable for use in a slicing operation. That is, the header “Range: bytes=3-6”, if applied against a Python string, is requesting resource[3:7]. This function will return the list [(3, 7)].

If this function returns an empty list, you should return HTTP 416.