I used to check our web apps' usage since the app was created in the mid april in 2020 . Last week, I realized that the usage search only offers up to 1 year range, and had to some manual calculation to get the cumulated total and average usage per day. It was quite inconvenient and I hope to get the number using Python API.
I searched some resources but I don't see any example which actually used a custom range. Has anyone done it? What all I need is total cumulated number and daily average.
Even if I cannot do over 1 year, if I can apply custom date range with Python API, I can probably skip manual calculation work.
I've been doing some hocky stuff off Jason's code. I was kinda hoping I could import pandas and use that as a date, something like:
but I can't get it to work :(
from arcgis.gis import GIS from IPython.display import display gis = GIS("home") items = gis.content.search(query="type:Web Apps") for item in items: try: itemHistory = item.usage(date_range='1Y', as_df=True) # <--- Looking in the past 12 months total = itemHistory['Usage'].sum() if total <20: # <--- Less than 20 total views display(item) except: pass