flask_zipper.zipper module

class flask_zipper.zipper.Zipper(app=None)[source]

Bases: object

An object used to hold compressor settings for the Flask-Zipper extension. Instances of Zipper are not bound to specific apps, so you can create one in the main body of your code and then bind it to your app in a factory function.

static _set_default_configuration_options(app)[source]

Sets the default configuration options used by this extension

static _set_default_errorhandler(app)[source]

Sets the default error handler used by this extension

encode_response(accept_encoding_string: str, compressor, error_class: Exception, response)[source]

A encoder to compress response with delivered compressor and other arguments

Parameters:
  • accept_encoding_string – Content-Encoding argument like br, ‘deflate’, gzip
  • compressor – Compressor in flask_zipper.compressor
  • error_class – Exception in flask_zipper.exceptions
  • response – Response object to compress
Returns:

Compressed response

init_app(app)[source]

Register this extension with the flask app. :param app: A flask application