Skip to main content
Version: Next

ZstdHttpCompressor

Compresses request bodies using zstd.

Uses the standard library compression.zstd module on Python 3.14 and newer, provided the Python build includes it. On older versions it requires the zstd extra: pip install "apify-client[zstd]".

Hierarchy

Index

Methods

__init__

  • __init__(*, quality): None
  • Initialize the zstd compressor.


    Parameters

    • optionalkeyword-onlyquality: int = 3

      Compression level, from the fastest to the best compression. zstd's levels 20 to 22 are not accepted: their window exceeds the 8 MB that HTTP decoders are required to support.

    Returns None

compress

  • compress(data): bytes
  • Compress a request body.


    Parameters

    • data: bytes

      The raw bytes to compress.

    Returns bytes

    The compressed bytes.

Properties

content_encoding

content_encoding: str

Value sent in the Content-Encoding header, for example gzip or br.

Page Options