kombu.compression

Compression utilities.

Encoding/decoding

kombu.compression.compress(body, content_type)[source]

Compress text.

Parameters:
  • body – The text to compress.
  • content_type – mime-type of compression method to use.
kombu.compression.decompress(body, content_type)[source]

Decompress compressed text.

Parameters:
  • body – Previously compressed text to uncompress.
  • content_type – mime-type of compression method used.

Registry

kombu.compression.encoders()[source]

Return a list of available compression methods.

kombu.compression.get_encoder(t)[source]

Get encoder by alias name.

kombu.compression.get_decoder(t)[source]

Get decoder by alias name.

kombu.compression.register(encoder, decoder, content_type, aliases=[])[source]

Register new compression method.

Parameters:
  • encoder – Function used to compress text.
  • decoder – Function used to decompress previously compressed text.
  • content_type – The mime type this compression method identifies as.
  • aliases – A list of names to associate with this compression method.