ArcGIS API for Python: Change limit of 10 on the number of results returned?

10-28-2020 07:34 AM
New Contributor

I understand that the has a max_items parameter, but what about all of the other tools? Is there a property that can be set in the GIS object or anywhere else?

Take the item.dependent_to() method for example. The documentation does not list any parameters or make any mention that a limit exists in the first place:


Returns items, urls, etc that are dependent to this item. This capability (item dependencies) is not yet available on ArcGIS Online. Currently it is available only with an ArcGIS Enterprise.

A python example:

from arcgis.gis import GIS

g = GIS(profile='xxx')
print("Connected to: {}\nConnected as: {}".format( g.url ,

id_of_interest = 'bd9902d1c85c4bfab5636af782a89219'
item_of_Interest = g.content.get(id_of_interest)

dep_to = item_of_Interest.dependent_to()
### Returns 10 ###

Returns 10 items.

My workaround function is relatively slow but proves that there are 44 dependencies:

def Find_WMs_using_layer(layer_item, webmaps_list=[]):
    if not webmaps_list:
        webmaps_list ="*", item_type="Web Map", max_items = 300, outside_org=False)
    print('%s webmaps found in portal' % len(webmaps_list))
    id_of_interest =

    out_webmaps = []
    lyr = None
    for wm in webmaps_list:
        raw_data = wm.get_data()
        lyrs = raw_data['operationalLayers']
        for lyr in lyrs:
            if 'itemId' in lyr.keys() and lyr['itemId'] == id_of_interest:
                print("\t %s contains layer of interest as %s" % ( wm.title, lyr['title']))
    return out_webmaps

id_of_interest = 'bd9902d1c85c4bfab5636af782a89219'
item_of_Interest = g.content.get(id_of_interest)

webmaps = Find_WMs_using_layer(item_of_Interest, webmaps_list=[])

Returns 44 webmaps that contain a layer using the item ID provided.

The same behavior is displayed for the dependent_upon() method.

Does anyone know a way to alter the 10 item max?

Are there any other methods that display this behavior we can compile a list of tools?

Thank you!

0 Kudos
1 Reply
New Contributor

Hi! I ran into the same problem. I needed to reliably get a list of *all* dependencies of an item, not just maximum 10. I was very surprised also, that the Docs does not mention this. The returned structure of Item.dependent_to() does hint or somehow suggest, that it must be called repeatedly to build up the full results. My workaround was to use the Item.dependencies property:

deps = dict(['items']
deps = [d['id'] for d in deps if 'id' in d.keys()]
deps = [webgis.content.get(id) for id in deps]

Btw clicking text formatting buttons in this Forum does nothing with a modern Chrome Browser. Yay!