Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Return boto3 reponses from method client method calls for #208 #209

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 18 additions & 18 deletions pycognito/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import requests

from .aws_srp import AWSSRP
from .exceptions import TokenVerificationException, MFAChallengeException
from .exceptions import MFAChallengeException, TokenVerificationException


def cognito_to_dict(attr_list, attr_map=None):
Expand Down Expand Up @@ -427,7 +427,7 @@ def confirm_sign_up(self, confirmation_code, username=None):
"ConfirmationCode": confirmation_code,
}
self._add_secret_hash(params, "SecretHash")
self.client.confirm_sign_up(**params)
return self.client.confirm_sign_up(**params)

def resend_confirmation_code(self, username):
"""
Expand All @@ -440,7 +440,7 @@ def resend_confirmation_code(self, username):
"Username": username,
}
self._add_secret_hash(params, "SecretHash")
self.client.resend_confirmation_code(**params)
return self.client.resend_confirmation_code(**params)

def admin_authenticate(self, password):
"""
Expand Down Expand Up @@ -515,7 +515,7 @@ def logout(self):

def admin_update_profile(self, attrs, attr_map=None):
user_attrs = dict_to_cognito(attrs, attr_map)
self.client.admin_update_user_attributes(
return self.client.admin_update_user_attributes(
UserPoolId=self.user_pool_id,
Username=self.username,
UserAttributes=user_attrs,
Expand All @@ -529,7 +529,7 @@ def update_profile(self, attrs, attr_map=None):
names we would like to show to our users
"""
user_attrs = dict_to_cognito(attrs, attr_map)
self.client.update_user_attributes(
return self.client.update_user_attributes(
UserAttributes=user_attrs, AccessToken=self.access_token
)

Expand Down Expand Up @@ -650,7 +650,7 @@ def send_verification(self, attribute="email"):
:param attribute: Attribute to confirm. Defaults to "email"
"""
self.check_token()
self.client.get_user_attribute_verification_code(
return self.client.get_user_attribute_verification_code(
AccessToken=self.access_token, AttributeName=attribute
)

Expand Down Expand Up @@ -686,20 +686,20 @@ def initiate_forgot_password(self):
"""
params = {"ClientId": self.client_id, "Username": self.username}
self._add_secret_hash(params, "SecretHash")
self.client.forgot_password(**params)
return self.client.forgot_password(**params)

def delete_user(self):
self.client.delete_user(AccessToken=self.access_token)
return self.client.delete_user(AccessToken=self.access_token)

def admin_delete_user(self):
self.client.admin_delete_user(
return self.client.admin_delete_user(
UserPoolId=self.user_pool_id, Username=self.username
)

def admin_reset_password(self, username, client_metadata=None):
if client_metadata is None:
client_metadata = {}
self.client.admin_reset_user_password(
return self.client.admin_reset_user_password(
UserPoolId=self.user_pool_id,
Username=username,
ClientMetadata=client_metadata,
Expand Down Expand Up @@ -797,7 +797,7 @@ def admin_add_user_to_group(self, username, group_name):
:param group_name: the name of the group to add the user to
:return:
"""
self.client.admin_add_user_to_group(
return self.client.admin_add_user_to_group(
UserPoolId=self.user_pool_id,
Username=username,
GroupName=group_name,
Expand All @@ -810,7 +810,7 @@ def admin_remove_user_from_group(self, username, group_name):
:param group_name: the name of the group to remove the user from
:return:
"""
self.client.admin_remove_user_from_group(
return self.client.admin_remove_user_from_group(
UserPoolId=self.user_pool_id,
Username=username,
GroupName=group_name,
Expand Down Expand Up @@ -852,7 +852,7 @@ def admin_enable_user(self, username):
:param username:
:return:
"""
self.client.admin_enable_user(
return self.client.admin_enable_user(
UserPoolId=self.user_pool_id,
Username=username,
)
Expand All @@ -863,7 +863,7 @@ def admin_disable_user(self, username):
:param username:
:return:
"""
self.client.admin_disable_user(
return self.client.admin_disable_user(
UserPoolId=self.user_pool_id,
Username=username,
)
Expand All @@ -879,7 +879,7 @@ def admin_create_identity_provider(
:param provider_details: The identity provider details
:return:
"""
self.client.create_identity_provider(
return self.client.create_identity_provider(
UserPoolId=pool_id,
ProviderName=provider_name,
ProviderType=provider_type,
Expand All @@ -905,7 +905,7 @@ def admin_update_identity_provider(self, pool_id, provider_name, **kwargs):
:param provider_name: The identity provider name
:return:
"""
self.client.update_identity_provider(
return self.client.update_identity_provider(
UserPoolId=pool_id,
ProviderName=provider_name,
**kwargs,
Expand All @@ -929,7 +929,7 @@ def admin_update_user_pool_client(self, pool_id: str, client_id: str, **kwargs):
:param client_id: The identity pool name
:return:
"""
self.client.update_user_pool_client(
return self.client.update_user_pool_client(
UserPoolId=pool_id,
ClientId=client_id,
**kwargs,
Expand Down Expand Up @@ -984,7 +984,7 @@ def set_user_mfa_preference(self, sms_mfa, software_token_mfa, preferred=None):
raise ValueError(
"preferred must have a value of 'SMS', 'SOFTWARE_TOKEN', or None."
)
self.client.set_user_mfa_preference(
return self.client.set_user_mfa_preference(
SMSMfaSettings=sms_mfa_settings,
SoftwareTokenMfaSettings=software_token_mfa_settings,
AccessToken=self.access_token,
Expand Down