Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Uploading a file to s3
#2
(Nov-25-2020, 08:42 PM)pisike Wrote: I am trying the below to upload a file to s3. I a, using python 2.7.

import boto3
from botocore.exceptions import NoCredentialsError
ACCESS_KEY = 'xxxxxxxxxxxxxx'
SECRET_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
def upload_to_aws(local_file, bucket, s3_file):s3 = boto3.client('s3', aws_access_key_id=ACCESS_KEY,aws_secret_access_key=SECRET_KEY)
#try:s3.upload_file(local_file, bucket, s3_file)
upload_to_aws('C:\Users\test_2_fields.csv', 'test-bukcet-aws', '/tmpload/test_2_fields.csv')

I am running into syntax error. can you please suggest what's wrong

I am getting syntax error. This is the whole code I have
Reply


Messages In This Thread
Uploading a file to s3 - by pisike - Nov-25-2020, 08:42 PM
RE: Uploading a file to s3 - by pisike - Nov-30-2020, 02:13 PM
RE: Uploading a file to s3 - by bowlofred - Nov-30-2020, 04:43 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  uploading files from a ubuntu local directory to Minio storage container dchilambo 0 581 Dec-22-2023, 07:17 AM
Last Post: dchilambo
  Uploading files to NAS from Raspberry PI using python zazas321 0 2,546 Sep-07-2020, 09:02 AM
Last Post: zazas321
  Uploading CSV Files to Google drive in a specified folder prashant8530 1 3,258 Sep-30-2017, 10:58 AM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020