mojakob commited on
Commit
55f2f7b
·
verified ·
1 Parent(s): 65abbab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -379,10 +379,7 @@ def save_to_excel(new_row, user_state):
379
  if s3_access_key and s3_secret_key and s3_endpoint and bucket_name:
380
  my_config = Config(
381
  signature_version="s3v4",
382
- s3={
383
- "addressing_style": "path",
384
- "payload_signing_enabled": False
385
- }
386
  )
387
 
388
  s3_client = boto3.client(
@@ -396,7 +393,8 @@ def save_to_excel(new_row, user_state):
396
  s3_key = f"Cond1/{local_file}"
397
 
398
  # Upload the file
399
- s3_client.upload_file(local_file, bucket_name, s3_key)
 
400
  print(f"Uploaded {local_file} to S3 bucket '{bucket_name}' at key: {s3_key}")
401
  else:
402
  print("No S3 credentials or bucket provided, skipping S3 upload.")
 
379
  if s3_access_key and s3_secret_key and s3_endpoint and bucket_name:
380
  my_config = Config(
381
  signature_version="s3v4",
382
+ s3={"addressing_style": "path"}
 
 
 
383
  )
384
 
385
  s3_client = boto3.client(
 
393
  s3_key = f"Cond1/{local_file}"
394
 
395
  # Upload the file
396
+ with open(local_file, "rb") as f:
397
+ s3_client.put_object(Bucket=bucket_name, Key=s3_key, Body=f)
398
  print(f"Uploaded {local_file} to S3 bucket '{bucket_name}' at key: {s3_key}")
399
  else:
400
  print("No S3 credentials or bucket provided, skipping S3 upload.")