Select to view content in your preferred language

Does using gis.content.search cause web maps to be viewed?

366
1
04-15-2024 12:33 PM
MAttiyeh
New Contributor

I have a python script that will pull each webmap from our ArcGIS Online account and tell me how many views it has.

The basics of the script are below but it seems to be adding views each time I run it. The script opens the JSON for each webmap and pulls the lastViewed and numViews fields.  Each time I run the script the lastViewed date is always today or yesterday for every webmap.

This doesn't seem right because I know some of our webmaps are years old and have only a handful of views. Is there a way around this? The code snippet below isn't the whole script but shows how I am getting the data so you can ignore the convert_unix_to_mm_dd_yyyy part. 

def find_feature_layers():
    
    username = "username"
    password = "password"
    
    # Create a GIS object to connect to ArcGIS Online
    gis = GIS("https://www.arcgis.com", username, password)

    data = []
    
    
    search_results = gis.content.search(query= '',item_type = 'Web Map', max_items = 1000) 
    
    #get info
    
    for item in search_results:
        last_viewed = convert_unix_to_mm_dd_yyyy(item.lastViewed)
        created = convert_unix_to_mm_dd_yyyy(item.created)
        modified = convert_unix_to_mm_dd_yyyy(item.modified)
        title = item.title
        numViewsStr = str(item.numViews)
        numViews = item.numViews
        data.append([last_viewed, title, numViews, created, modified])

 

0 Kudos
1 Reply
MichaelVolz
Esteemed Contributor

Yes it does.  I have 3rd party software to cycle thru my org's portal and it does the same thing.  It makes us think the webmap is being used when the software is only hitting it like your script does.

0 Kudos