i'm use Python Klein for my small API. Can return csv as response, but is this possible to return Excel file? Flask has this functional but what about Klein?
Task:
Have Excel file on hard drive and want return it to as attachment, so user can download it via API call.
Example: With csv file all is working good like
@app.route('/download/', branch=True, methods=['GET'])
def download(request):
request.setHeader("Access-Control-Allow-Origin", "*")
request.setHeader('Content-Type', 'text/csv')
request.setHeader('Content-Disposition', 'attachment; filename=test.csv')
file = open('test.csv', "r")
csv_data = file.read()
return csv_data
But how to be with an Excel file?