I am using the Chalice framework to create an API service. My users need to upload an image and then I need to save the image to an s3 bucket.
How should the user upload the image to my endpoint and what should my endpoint do once it receives it?
This is my thought process so far:
BUCKET = <bucket_name>
@app.route('/n_number_search/', methods=['POST'])
def n_number_search():
body = app.current_request.raw_body
s3_client.upload_file(body, BUCKET, UUID_file_name)
return Response(body=f'upload successful: {}', status_code=200,
headers={'Content-Type': 'text/plain'})
This is not working. I have reviewed the way to do this in flask but the syntax is a slightly different as flask has the request.files
attribute.