Greetings,
I am trying to loop through the Portal Gallery to get the itemId for all maps and/or apps.
I can get the itemId for a single app calling the item = xx
e.g.
# item = "6f91e6d30e8b4776b23dccb2fc560c94"
# print(i['numViews'])
When I use the example in https://esri.github.io/arcgis-python-api/apidoc/html/arcgis.apps.hub.html?highlight=itemid, get Attr...
import arcgis
from arcgis.gis import GIS
from arcgis import apps
from arcgis.apps import hub
url = "https://myarcgis.com/portal/home/gallery.html"
### Make a connection to the portal
gis = GIS(url=url)
myHub = gis.hub
a_Initiative = myHub.initiatives.get('itemId *')
for i in a_Initiative:
print(I)
"C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\python.exe" C:/Temp/DEV/GetPortalViewCounts.py
Traceback (most recent call last):
File "C:/Temp/DEV/GetPortalViewCounts.py", line 7, in <module>
from arcgis.apps import hub
ImportError: cannot import name 'hub'
Process finished with exit code 1
Regards,
Clive
I tried this on my side, not too sure why it expects it to be an Online organization when the docs indicate it can be an ArcGIS Enterprise deployment:
Might want to reach out to tech support or create an issue in the arcgis-python-api repo to see what's going on.