Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/amazon-web-services/12.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 上传到S3时添加元数据(x-amz-meta-SOMEINFO)_Python_Amazon Web Services_Amazon S3 - Fatal编程技术网

Python 上传到S3时添加元数据(x-amz-meta-SOMEINFO)

Python 上传到S3时添加元数据(x-amz-meta-SOMEINFO),python,amazon-web-services,amazon-s3,Python,Amazon Web Services,Amazon S3,我正在寻找一种在将文件上载到AWS S3时以编程方式插入自定义元数据(x-amz-meta-SOMEINFO)的方法 目前,我正在使用下面的命令,使用Python lambda函数将文件插入S3 bucket 打开('/tmp/newFile.docx', “wb”).write(附件.get_有效负载(decode=True)) s3r.meta.client.upload_文件('/tmp/newFile.docx',outputBucket, 附件。获取文件名() 我能够使用“ExtraA

我正在寻找一种在将文件上载到AWS S3时以编程方式插入自定义元数据(x-amz-meta-SOMEINFO)的方法

目前,我正在使用下面的命令,使用Python lambda函数将文件插入S3 bucket

打开('/tmp/newFile.docx', “wb”).write(附件.get_有效负载(decode=True)) s3r.meta.client.upload_文件('/tmp/newFile.docx',outputBucket, 附件。获取文件名()


我能够使用“ExtraArgs”解决上述问题

s3r.meta.client.upload_file('/tmp/newFile.docx', outputBucket, str(time.time())+'-'+attachment.get_filename(),
    ExtraArgs={"Metadata": {"SOMEINFO": value}})
元数据“SOMEINFO”将另存为x-amz-meta-SOMEINFO”