Я пытаюсь загрузить файл JSON, используя boto3 Python на s3 Amazon. Файл успешно загружается, но я не получаю возвращенный URL-адрес publi c.
Вот мой код:
import boto3
from botocore.exceptions import NoCredentialsError
from credential import ACCESS_KEY , SECRET_KEY
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)
print("Upload Successful")
return True
except FileNotFoundError:
print("The file was not found")
return False
except NoCredentialsError:
print("Credentials not available")
return False
uploaded = upload_to_aws('temp_file.json', 'feed-crawler', '0output_test.json')