编程语言
首页 > 编程语言> > python-boto3创建未过期的URL

python-boto3创建未过期的URL

作者:互联网

在boto3中,有一个函数可以生成以生成预签名的URL,但是它们会超时.
查看:http://boto3.readthedocs.io/en/latest/reference/services/s3.html#S3.Client.generate_presigned_url

有没有一种方法可以创建不会过期的非预签名URL?

解决方法:

无法创建无预签名的URL或没有到期的预签名的URL.预签名URL的基本用法是

A pre-signed URL gives you access to the object identified in the URL,
provided that the creator of the pre-signed URL has permissions to
access that object. That is, if you receive a pre-signed URL to upload
an object, you can upload the object only if the creator of the
pre-signed URL has the necessary permissions to upload that object.

All objects and buckets by default are private. The pre-signed URLs
are useful if you want your user/customer to be able upload a specific
object to your bucket, but you don’t require them to have AWS security
credentials or permissions. When you create a pre-signed URL, you must
provide your security credentials, specify a bucket name, an object
key, an HTTP method (PUT for uploading objects), and an expiration
date and time. The pre-signed URLs are valid only for the specified
duration.

您可以将最长有效期设置为7天,即604800秒.

check here获取更多信息.

请检查上方链接中表格中的X-Amz-Expires.

标签:python-2-7,boto3,python
来源: https://codeday.me/bug/20191026/1938732.html