Returning a PDF from S3 in Flask Returning a PDF from S3 in Flask flask flask

Returning a PDF from S3 in Flask


It turns out that boto3 doesn't have a readLines() method but they do have a read() method, so it worked by doing:

response = make_response(file['Body'].read())response.headers['Content-Type'] = 'application/pdf'return response