【问题标题】:How to generate S3 presigned URL with boto3 resource instead of client如何使用 boto3 资源而不是客户端生成 S3 预签名 URL
【发布时间】:2021-12-28 04:16:19
【问题描述】:

我尝试重构使用s3 = boto3.resource('s3')resource)作为 S3 实例的应用程序。

但只有Client 类有generate_presigned_url 方法。那么,如何获取带有resource 的预签名 URL?

在互联网上很多examplesexamples 如何使用client 获取预签名URL,但resource 没有。

【问题讨论】:

    标签: python amazon-web-services amazon-s3 boto3


    【解决方案1】:

    您可以通过这种方式访问​​与资源关联的客户端:

    s3 = boto3.resource('s3')
    url = s3.meta.client.generate_presigned_url(...)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-12-06
      • 2017-07-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-11-05
      • 2017-01-09
      相关资源
      最近更新 更多