'Is there a way to send a zip file from server via api using flask-python?

I need to develop an api in which zip file is stored in server and gets synced at client side when requested by it. Is there a way to do that?



Solution 1:[1]

To return a file flask provides the send_file() function.

return send_file('<FILE_PATH>', as_attachment=True, attachment_filename='<FILE_ATTACHMENT_NAME>')

Here the link to the documentation

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Matteo Pasini