Decorators

sovereign.decorators.envoy_authorization_required(decorated)

Decorator that checks a functions args for something that resembles an envoy discovery request, and attempts to decrypt the authorization that it contains.

Raises an exception if there is no discovery request, or if the authorization token fails to decrypt.

sovereign.decorators.gzcompress(level=2, valid_codes=range(200, 304))

Gzip compression decorator from : http://flask.pocoo.org/snippets/122/

Modified to work with Quart Also added configurable compression level & status codes

Unfortunately does not work with Envoy since it doesn’t send gzip related headers

sovereign.decorators.memoize(timeout)

Decorator to cache a function by name/args

Parameters:timeout – How long to keep the result