This may look like a duplicate post, which @Clubdebambos solved. But although that solution worked for updating item thumbnails, my script still fails when trying to update group thumbnails. Unfortunately there appears to be no equivalent "update_thumbnail" method for the group object. I updated my test script to target a group:
# To recreate problem
# 1. Update the GROUP_ID variable below to an ArcGIS online group id that you own
# 2. Copy this entire script file and paste it into the ArcGIS Pro (make sure you are signed in)python analysis window, hit enter twice
# 3. Enter run_test()
GROUP_ID = 'e3fb48baf4834208bb545894c3fb7e6a'
from arcgis.gis import GIS
import requests
import os
def test_upload_as_thumbnail (group, path):
try:
group.update(thumbnail = path)
print (f"Upload {path} to {group.id} as thumbnail succeeded")
except Exception as ex:
print (f"Upload {path} to {group.id} as thumbnail failed: {str(ex)}")
return
def test_download (url):
if url.lower().startswith('http'):
try:
requests.get(url).content
print (f"Download {url} succeeded")
except Exception as ex:
print (f"Download {url} failed: {str(ex)}")
return
def run_test():
gis = GIS('pro')
for url in ['http://maps.fieldmuseum.org/apps/ROWHWG/icons/FeatureLayer.png', # this one works
'https://rightofway.erc.uic.edu/wp-content/uploads/FeatureLayer_600_400.png', # this one fails
'https://rightofway.erc.uic.edu/wp-content/uploads/FeatureLayer.png']: # this one fails
test_download (url)
test_upload_as_thumbnail(gis.groups.get(GROUP_ID), url)
Solved! Go to Solution.
ESRI support basically punted on this. I was able to work around the problem by adding code to download the images to the local file system then doing the upload from there.
You should probably report this one 😅
Yep - I just opened ESRI Case#03852350. I'll post back here if anything comes out of it
ESRI support basically punted on this. I was able to work around the problem by adding code to download the images to the local file system then doing the upload from there.