Returns a list of the collections tagged with this tag.

Required arguments

None

Optional keyword arguments

See collections.list( ) for a list of supported arguments.

Example 1

The first example assumes you know the index of the tag you want (to do this programmatically, see Example 2). You can get a list of tags and their indices as shown here:

public = enigma.Public()
tags = public.tags.list()
for index, tag in enumerate(tags):
    print('{}: {}'.format(index, tag.name))
0: agriculture
1: art
2: buildings
3: companies
4: compliance
5: demographics
6: energy
7: health
8: politics
9: transit
10: restaurant inspections
11: immigration

This example returns collections tagged with art, which has index 1.

collections = tags[1].collections()

Example 2

The next example returns all collections tagged with politics, and first determines the index of the tag with name attribute politics.

public = enigma.Public()
tags = public.tags.list()
index = next((idx for (idx, tag) in enumerate(tags) if tag.name == 'politics'), None)
collections = tags[index].collections() if index else []