AnsweredAssumed Answered

Scheduled Python script fails after token expiration

Question asked by lbross_pdxedu on Oct 18, 2019

Our organization hosts a Pro Python script for another organization. This script updates feature service layers on the second organization's portal. On our host computer, ArcGIS Pro uses the named user licensing option. We have enabled the 'Authorize ArcGIS Pro to work offline' option with one of our users so that the second organization doesn't need to supply a Pro license.

 

ArcGIS Pro provides the option to sign on to multiple portals so we thought we could establish an AGOL account on the second organization's portal to publish the feature service layers directly to their portal. And this works great, for two weeks until the organization's portal token expires. We start getting a runtime error with this method call: arcpy.mp.CreateWebLayerSDDraft().

 

If I log onto the server that hosts the script and log into the organization's portal through Pro, the script runs fine for the next two weeks. This is obviously not ideal for a regularly scheduled process that is intended to run unattended. Is there a Python API available to connect to an organization's portal without running Pro? Any other suggestions?

Outcomes