Make a file in s3 public using python and boto

后端 未结 4 1893
半阙折子戏
半阙折子戏 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:42

    This seems to work with boto 2.42.0 and Python 3

    s3 = boto.connect_s3()
    b = s3.get_bucket('brianray')
    k = Key(b)
    k.key = new_file_name
    k.set_contents_from_filename(new_file_name)
    k.set_acl('public-read')
    k.generate_url(expires_in=0, query_auth=False)
    

提交回复
热议问题