无法从boto上传图片到亚马逊s3

时间:2017-03-30 08:57:24

标签: python amazon-s3

我需要将图像上传到Amazon S3存储桶,我有AWS_KEY,AWS_SECRET和Bucket名称。 请找到下面的代码将图像上传到aws s3。当我尝试上传获取时,出现以下错误...

name
  

boto.exception.S3ResponseError:S3ResponseError:400 Bad Request   AWS_KEY = "xxxxxx" AWS_SECRET = "xxxxxx" from boto.s3.connection import S3Connection from boto.s3.key import Key filenames = ['D:/Share/1_test.png'] conn = S3Connection(aws_access_key_id=AWS_KEY, aws_secret_access_key=AWS_SECRET) for fname in filenames: print fname bucket = conn.get_bucket("xxxxxxx",validate = False) print bucket #key = bucket.new_key(fname).set_contents_from_string('test img') key = Key(bucket) key.key = fname key.set_contents_from_filename(fname) print "uploaded file %s" % fname 授权机制   您提供的不受支持。请用   AWS4-HMAC-SHA256.0E67564A45D10F51UCh6NhAz2x75gW17D4pMNxPepLn7q3ISXZzzucA + BD / oDRC + rSv8nlnGB / ejgUsGaofDu1rLy9g =

0 个答案:

没有答案
相关问题