Make a file in s3 public using python and boto

后端 未结 4 1875
半阙折子戏
半阙折子戏 2021-02-18 21:20

I have thins link below, and when I try to acess it it appears an xml file saying \"Acess denied\".

And I need to go to aws managment console and make this part-00

4条回答
  •  有刺的猬
    2021-02-18 21:31

    from boto3.s3.transfer import S3Transfer
    import boto3
    
    # ...
    # have all the variables populated which are required below
    
    client = boto3.client('s3', aws_access_key_id=access_key,
                          aws_secret_access_key=secret_key)
    transfer = S3Transfer(client)
    transfer.upload_file(filepath, bucket_name, folder_name+"/"+filename)
    response = client.put_object_acl(ACL='public-read', Bucket=bucket_name, Key="%s/%s" % (folder_name, filename))
    

提交回复
热议问题