What I am trying to do is
first, get the input as an excel form from the user
second, process it with python code,
third, upload it to aws s3 with boto3
But I am having a trouble uploading to s3
s3 = boto3.client(
"s3",
aws_access_key_id=access_key,
aws_secret_access_key=secret_key
)
bucket_resource = s3
I created s3 object first, and
excel_file = pd.read_excel(file.stream)
try:
result = compute.select_bestitem(excel_file, brand_name, col_name, methods, operator, value)
filename = secure_filename(file.filename)
bucket_resource.upload_file(
Bucket=bucket_name,
Filename=,
Key=filename
)
I already got file as file = request.files['file'], and passed it to the function I defined earlier
Now, the file which I want to upload to S3 is 'result object', which is the result of select_bestitem function
But I don't know what to pass to Filename argument
It seems like I have to give file path to it, but I can't find the path of file stored in localstorage
Plus, I am really not sure if it works even if I pass the correct file path, since the type of the file
I am trying to upload is string
(I created the 'result' object with Pandas to_csv command, and it looks like somehow boto3 rejects this type)
I am quite new to python and flask stuff, so any help would be great! Thanks in advance :)