Hit*_*try 5 python amazon-s3 amazon-ec2 boto amazon-web-services
在AWS S3中,如何为文件生成文件下载URL而不会过期.
conn = boto.connect_s3(awsAccessKey, awsSecret)
# Get bucket instance.
bucket = conn.get_bucket(bktName)
fileKey = bucket.get_key(fileKey)
url = fileKey.generate_url(expires_in=None, query_auth=True, force_http=True)
print url
Run Code Online (Sandbox Code Playgroud)
如何为文件生成url而没有到期?
根据最新文档(http://docs.aws.amazon.com/AmazonS3/latest/API/sigv4-query-string-auth.html):
预签名URL最多可以有效七天,因为您在签名计算中使用的签名密钥有效期最长为七天.
由于签名本身只能有效七天,因此签名URL无法生效超过七天.拥有永久有效URL的唯一方法是将文件设为公共.
| 归档时间: |
|
| 查看次数: |
1733 次 |
| 最近记录: |