使用临时SAML身份验证,在运行python代码和导入boto3时无法找到AWS凭证
我可以登录到SAML帐户并使用AWS cli正常进行身份验证并指定其他配置文件。
试图设置AWS_CREDENTIALS_PATH ='〜/ .aws / credentials'并拾取临时创建的密钥,需要配置文件前缀
#!/usr/bin/env python3
import boto3
AWS_CREDENTIALS_PATH = '~/.aws/credentials'
OPENAM_SEARCH_STRING = 'XUI/#login/&'
session = boto3.Session(profile_name='Admin_Profile')
# Any clients created from this session will use credentials
# Let's use Amazon S3
s3 = boto3.resource('s3')
# Print out bucket names
for bucket in s3.buckets.all():
print(bucket.name)
期望找到信誉并登录。
Error Received:
in add_auth
raise NoCredentialsError
botocore.exceptions.NoCredentialsError: Unable to locate credentials