# HttpCompressor<!-- -->

Strategy for compressing HTTP request bodies.

Extend this class to create a custom compressor. Set `content_encoding` to the value that should be sent in the `Content-Encoding` header and implement `compress`.

### Hierarchy

* *HttpCompressor*

  * [BrotliHttpCompressor](https://docs.apify.com/api/client/python/api/client/python/reference/class/BrotliHttpCompressor.md)
  * [GzipHttpCompressor](https://docs.apify.com/api/client/python/api/client/python/reference/class/GzipHttpCompressor.md)

## Index[**](#Index)

### Methods

* [**compress](https://docs.apify.com/api/client/python/api/client/python/reference/class/HttpCompressor.md#compress)

### Properties

* [**content\_encoding](https://docs.apify.com/api/client/python/api/client/python/reference/class/HttpCompressor.md#content_encoding)

## Methods<!-- -->[**](#Methods)

### [**](#compress)compress

* ****compress**(data): bytes

- Overrides [HttpCompressor.compress](https://docs.apify.com/api/client/python/api/client/python/reference/class/HttpCompressor.md#compress)

  Compress a request body.

  ***

  #### Parameters

  * ##### data: bytes

    The raw bytes to compress.

  #### Returns bytes

  The compressed bytes.

## Properties<!-- -->[**](#Properties)

### [**](#content_encoding)content\_encoding

**content\_encoding: str

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