When using arcgis.groups.search (from the ArcGIS Python API) to return the list of groups for a user on our ArcGIS Online instance, it appears to return incorrect results for users who own more than 100 groups. For instance:
from arcgis.gis import GIS
gis = GIS("<AGO URL>", "<admin username>", "<password>")
users = gis.users.search(query=None, sort_field='username', sort_order='asc', max_users=10000)
for user in users:
groups_owner = "owner:" + user['username']
groups_count = len(gis.groups.search(query=groups_owner, max_groups=1000))
if( groups_count > 0 ):
print(groups_owner, ",", groups_count)
For users owning more than 100 groups, the above appears to return a list that has as many items as the value of max_groups, regardless of how many groups the user actually owns. For instance, for each user owning more than 100 groups, the result list always has 1000 items. And, if you examine the returned list, it is composed of the first 100 groups repeated over and over until the max_groups value is reached.
Anyone else run into this possible bug, and know a way around it?