[Python] how to get list of users based on created date/updated date from cognito

Discussão em 'Python' iniciado por Stack, Junho 26, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to fetch users from Cognito with sub and created date, able to fetch the user using sub but it's not accepting for created date, as this is not attribute to pass for filter. Below is the code for the same, i want to pass created in filter Filter="created ="2020-06-30""

    import boto3

    client = boto3.client('cognito-idp',region_name='us-east-2',
    aws_access_key_id='XXXXXX',
    aws_secret_access_key='XXXXXXX',
    )

    response1 = client.list_users(UserPoolId='us-east-2_XXXXXX',AttributesToGet=
    ['birthdate','name','sub'], Filter="sub =\"XXXXX-dCCa-4121-94c9-XXXXXX\"")

    print(response1)


    error: InvalidParameterException: An error occurred (InvalidParameterException) when calling the ListUsers operation: Invalid search attribute: UserCreateDate

    Continue reading...

Compartilhe esta Página