Created
February 16, 2017 08:20
-
-
Save hideokamoto/fb9aa9657977f22f09ed173d61205970 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boto3 | |
cognito = boto3.client('cognito-idp') | |
UserPoolId='YOUR_USERPOOL_ID' | |
def getUsers(): | |
response = cognito.list_users( | |
UserPoolId=UserPoolId, | |
Filter="cognito:user_status='CONFIRMED'" | |
) | |
return response | |
def getUsersWithPagenation(PaginationToken): | |
response = cognito.list_users( | |
UserPoolId=UserPoolId, | |
PaginationToken=PaginationToken, | |
Filter="cognito:user_status='CONFIRMED'" | |
) | |
return response | |
def listUsers(users, num): | |
num += len(users['Users']) | |
if 'PaginationToken' in users: | |
users = getUsersWithPagenation(users['PaginationToken']) | |
listUsers(users, num) | |
else: | |
print(num) | |
num = 0 | |
users=getUsers() | |
listUsers(users, num) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment