3
votes

I would like to be able to compress the data sent from a client to a django server. The data I need to compress is mainly binary, but some endpoints receive also large jsons with binary data encoded to base64.

I've found lots of info regarding the opposite way (server returning compressed response) for example https://docs.djangoproject.com/en/1.2/ref/middleware/#module-django.middleware.gzip, however this is not what I need.

What I'm basically asking is:

  1. Is there a standard/recommended way for compressing client requests? gzip, LZW, Huffman...

  2. How do I support this in Django?

1
nope that does not exists; did you consider sending gzipped files to your app instead ? - Tommaso Barbugli
Eventually I added gzip functionality in specific places in the application, and in the corresponding places in the server. - odedfos

1 Answers

0
votes

Responses:

1 - You could compress the data on the client and then send it to the server. I've seen Javascript libraries to compress to ZIP. The data can be uncompressed on the server.

2 - Uncompress the request parameter using Python zip library.