__main__.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:awsmfa 作者: dcoker 项目源码 文件源码
def make_session(identity_profile):
    session = botocore.session.Session(profile=identity_profile)
    try:
        session3 = boto3.session.Session(botocore_session=session)
    except botocore.exceptions.ProfileNotFound as err:
        print(str(err), file=sys.stderr)
        if session.available_profiles:
            print("Available profiles: %s" %
                  ", ".join(sorted(session.available_profiles)), file=sys.stderr)
            print("You can specify a profile by passing it with the -i "
                  "command line flag.", file=sys.stderr)
        else:
            print("You have no AWS profiles configured. Please run 'aws "
                  "configure --profile identity' to get started.", file=sys.stderr)
        return None, None, USER_RECOVERABLE_ERROR
    return session, session3, None
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号