All of the SDK client’s list() methods, as well as collection.child_collections( ) and collection.child_datasets( ), return a ResourceList with at most 20 resources. For example, datasets.list( ) returns the first 20 datasets by display name.

If you want more than 20 resources, you can append .all() to any of these methods. For example, to request all available datasets, use datasets.list().all(). This returns a ResourceList object that represents the entire batch and supports all standard list operations (indexing, slicing, iterating over, etc.), but fetches resources from the server only as needed.

The example below illustrates the use of .all() to get a ResourceList object representing all collections that are children of the U.S. Federal Government collection. Because the SDK uses the HTTP content range header to determine the number of matching resources, and uses range headers to request resources as needed, operations like len() and iterating over a slice can be done quickly.

public = enigma.Public()
fed_collection = 'bf068aa3-a15c-4db3-bdb1-6d51f91eae5a' # US Fed Govt collection
children = public.collections.get(fed_collection).child_collections().all()
print('Total collections: {}'.format(len(children)))
print('Last 5 collections:')
for collection in children[-5:]:
    print(collection.display_name)

Output:

Total collections: 65
Last 5 collections:
U.S. Department of the Treasury
U.S. Spending
Internal Revenue Service (IRS)
Department of Homeland Security
Securities and Exchange Commission (SEC)