我可以匿名使用boto3吗? [英] Can I use boto3 anonymously?

查看:152
本文介绍了我可以匿名使用boto3吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用boto,我可以通过传递anon=关键字参数来连接到公共S3存储桶而无需凭据.

With boto I could connect to public S3 buckets without credentials by passing the anon= keyword argument.

s3 = boto.connect_s3(anon=True)

boto3有可能吗?

推荐答案

是.您的凭据用于对您发出的所有请求进行签名,因此您要做的就是将客户端配置为完全不执行签名步骤.您可以按照以下步骤进行操作:

Yes. Your credentials are used to sign all the requests you send out, so what you have to do is configure the client to not perform the signing step at all. You can do that as follows:

import boto3
from botocore import UNSIGNED
from botocore.client import Config

s3 = boto3.client('s3', config=Config(signature_version=UNSIGNED))
# Use the client

这篇关于我可以匿名使用boto3吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆