GithubHelp home page GithubHelp logo

Comments (4)

dt3310321 avatar dt3310321 commented on August 29, 2024

client.get_presigned_url(
Bucket='xxxxx-xxxxxxxxxx',
Key=filekey,
Method='GET',
Params={'x-cos-security-token': tmpkey['credentials']['sessionToken']}
)

from cos-python-sdk-v5.

sjhstone avatar sjhstone commented on August 29, 2024

client.get_presigned_url(
Bucket='xxxxx-xxxxxxxxxx',
Key=filekey,
Method='GET',
Params={'x-cos-security-token': tmpkey['credentials']['sessionToken']}
)

感谢回复,临时密钥的tmpSecretIdtmpSecretKey还有sessionToken生命周期是一致的,既然前两者在构造CosConfig时就已经明确,那sessionToken最好在同一个创建时传入。或者建议在说明文档附近添加一些提示,因为说明文档是在构造CosConfig的时候就传入Token了,写清楚的话可以避免debug的时候绕圈子。

.. code-block:: python
config = CosConfig(Region=region, SecretId=secret_id, SecretKey=secret_key, Token=token) # 获取配置对象
client = CosS3Client(config)
# 获取预签名链接
response = client.get_presigned_url(
Bucket='bucket',
Key='test.txt',
Method='PUT'
)

from cos-python-sdk-v5.

dt3310321 avatar dt3310321 commented on August 29, 2024

这里主要是考虑代码内部的x-cos-secutiry-token是以头部的形式传到COS,get_presigned_url这里是以URL的形式拼接的,如果客户需要明确的在URL里面带上临时秘钥,需要在生成的时候,明确指定params。后续这里会在get_presigned_url这里加强相关的说明。

from cos-python-sdk-v5.

sjhstone avatar sjhstone commented on August 29, 2024

这里主要是考虑代码内部的x-cos-secutiry-token是以头部的形式传到COS,get_presigned_url这里是以URL的形式拼接的,如果客户需要明确的在URL里面带上临时秘钥,需要在生成的时候,明确指定params。后续这里会在get_presigned_url这里加强相关的说明。

OK,感谢说明

from cos-python-sdk-v5.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.