Python Forum
Help with filtering in Python - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: General Coding Help (https://python-forum.io/forum-8.html)
+--- Thread: Help with filtering in Python (/thread-18842.html)



Help with filtering in Python - Junes786 - Jun-03-2019

Hi, i am new to python and trying to learn a new language.

I am attempting to filter some output, but can't get my head around the syntax.

def filter_user_pools():
listpools = client.list_user_pools.filter(
Filters=[{'Id': 'UserPoolId'}])
for list in listpools:
    print(list.Id)
I am trying to output the filter the following output

{'UserPools': [{'Id': 'eu-west-1_asdasdg34', 'Name': 'JenkinsDevelopMarketplace', 'LambdaConfig': {'PreSignUp':...
I want the second field - eu-west_1

Any help, will be appericated.


RE: Help with filtering in Python - Yoriz - Jun-03-2019

The code doesn't run as it is, the indentation has gone, what is a client object? where does the input come from ?.


RE: Help with filtering in Python - Junes786 - Jun-05-2019

import boto3

client = boto3.client('cognito-idp')

def user_pool():
    response = client.list_user_pools(
        NextToken="PaginationKeyType",
        MaxResults=20
    )