我从7升级到tomcat 8.是否需要添加此监听器?
<Listener className="org.apache.catalina.startup.VersionLoggerListener" />
Run Code Online (Sandbox Code Playgroud) 我想在将文件上传到 S3 时为其添加标签。Boto3 支持使用 put_object 方法指定标签,但是考虑到预期的文件大小,我使用 upload_file 函数来处理分段上传。但此函数拒绝“标记”作为关键字参数。
import boto3
client = boto3.client('s3', region_name='us-west-2')
client.upload_file('test.mp4', 'bucket_name', 'test.mp4',
ExtraArgs={'Tagging': 'type=test'})
ValueError: Invalid extra_args key 'Tagging', must be one of: ACL, CacheControl, ContentDisposition, ContentEncoding, ContentLanguage, ContentType, Expires, GrantFullControl, GrantRead, GrantReadACP, GrantWriteACP, Metadata, RequestPayer, ServerSideEncryption, StorageClass, SSECustomerAlgorithm, SSECustomerKey, SSECustomerKeyMD5, SSEKMSKeyId, WebsiteRedirectLocation
Run Code Online (Sandbox Code Playgroud)
我找到了一种方法来完成这项工作,直接使用 S3 传输管理器并修改允许的关键字列表。
from s3transfer import S3Transfer
import boto3
client = boto3.client('s3', region_name='us-west-2')
transfer = S3Transfer(client)
transfer.ALLOWED_UPLOAD_ARGS.append('Tagging')
transfer.upload_file('test.mp4', 'bucket_name', 'test.mp4',
extra_args={'Tagging': 'type=test'})
Run Code Online (Sandbox Code Playgroud)
尽管这有效,但我认为这不是最好的方法。它可能会产生其他副作用。目前我无法找到正确的方法来实现这一目标。任何建议都会很棒。谢谢。
python amazon-s3 amazon-web-services awss3transfermanager boto3