Skip to content

Commit

Permalink
Extend Cognito boto3 client handling (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
pvizeli authored Feb 27, 2020
1 parent afd4c49 commit 61535f6
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion pycognito/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ def __init__(
client_secret=None,
access_key=None,
secret_key=None,
session=None,
botocore_config=None,
):
"""
:param user_pool_id: Cognito User Pool ID
Expand All @@ -161,6 +163,8 @@ def __init__(
:param access_token: Access Token returned by authentication
:param access_key: AWS IAM access key
:param secret_key: AWS IAM secret key
:param session: Boto3 client session
:param botocore_config: Botocore Config object for the client
"""

self.user_pool_id = user_pool_id
Expand All @@ -184,8 +188,13 @@ def __init__(
boto3_client_kwargs["aws_secret_access_key"] = secret_key
if self.user_pool_region:
boto3_client_kwargs["region_name"] = self.user_pool_region
if botocore_config:
boto3_client_kwargs["config"] = botocore_config

self.client = boto3.client("cognito-idp", **boto3_client_kwargs)
if session:
self.client = session.client("cognito-idp", **boto3_client_kwargs)
else:
self.client = boto3.client("cognito-idp", **boto3_client_kwargs)

def get_keys(self):

Expand Down

0 comments on commit 61535f6

Please sign in to comment.