0

I'd like to have a REST webservice endpoint written with Flask (python3) which accepts a message compressed with Brotli. Is it supported in Flask?

A workaround which thought of is to have a non-compressed request body similar to this:

{
    content: {{brotli-compressed json: bytes/String}}
}

and just decompress the 'content' later in a code to a json.

Is this a valid approach? Or is there another library for python which supports brotli?

Disclaimer: I'm not an expert on webservices

motosx
  • 19
  • 2
  • 1
    Since you should never directly expose the Flask **development** server I'd say you put a webserver in front and let it do the en-/decoding. – Klaus D. Jan 15 '20 at 10:34
  • @KlausD. What exactly do you mean by saying that I should not directly expose Flask server? What is the right way to do it then? – motosx Jan 15 '20 at 12:06
  • The built-in webserver is a development tool only. Flask actually warns you about that on startup. In production chose one of these options: https://flask.palletsprojects.com/en/1.1.x/deploying/ – Klaus D. Jan 15 '20 at 13:02

0 Answers0