我在Ubuntu 16.04 LTS中使用Python 2.7.12.我正在学习如何使用以下链接中的boto3:https://boto3.readthedocs.io/en/latest/guide/quickstart.html#using-boto-3 .我怀疑的是何时使用资源,客户端或会话以及它们各自的功能.
当我只是运行以下代码时,我总是得到这个错误.
s3 = boto3.resource('s3')
bucket_name = "python-sdk-sample-%s" % uuid.uuid4()
print("Creating new bucket with name:", bucket_name)
s3.create_bucket(Bucket=bucket_name)
Run Code Online (Sandbox Code Playgroud)
我保存了我的凭据文件
C:\Users\myname\.aws\credentials,Boto应该从那里读取我的凭据.
我的设置错了吗?
这是输出boto3.set_stream_logger('botocore', level='DEBUG').
2015-10-24 14:22:28,761 botocore.credentials [DEBUG] Skipping environment variable credential check because profile name was explicitly set.
2015-10-24 14:22:28,761 botocore.credentials [DEBUG] Looking for credentials via: env
2015-10-24 14:22:28,773 botocore.credentials [DEBUG] Looking for credentials via: shared-credentials-file
2015-10-24 14:22:28,774 botocore.credentials [DEBUG] Looking for credentials via: config-file
2015-10-24 14:22:28,774 botocore.credentials [DEBUG] Looking for credentials via: ec2-credentials-file
2015-10-24 14:22:28,774 botocore.credentials [DEBUG] Looking …Run Code Online (Sandbox Code Playgroud)