Select to view content in your preferred language

arcpy access to secure feature services in notebook webtool fails

386
2
09-17-2024 11:09 AM
DonMorrison1
Frequent Contributor

I trying to develop a web tool from a notebook in ArcGIS Onine.  I can access public features services OK but not secured services.   Is there any way to make this work - including after I publish it as a web tool?  I'll need it to run under authority of the user running the web tool, so I can't use a known username and password to log in.

 

import arcpy
gis = GIS("home")
public_url = 'https://utility.arcgis.com/usrsvcs/servers/8bf6c4b09a3b4b2a8abadd08ac23e42b/rest/services/ROW/PublicData/FeatureServer/0'
private_url = 'https://utility.arcgis.com/usrsvcs/servers/de103079a25a422c9a92e26f35f4cf2d/rest/services/ROW/DEMO/FeatureServer/2'

arcpy.Describe(public_url) # Works
arcpy.Describe(private_url) #Fails "does not exist"

 

 

Tags (3)
0 Kudos
2 Replies
NicholasGiner1
Esri Contributor

Hi @DonMorrison1 - thanks for the question.  From you script, it looks like you are using the ArcGIS API for Python to authenticate:

gis = GIS("home")

However, we recommend that you try to sign into the portal through ArcPy.  Please try adding the line:

arcpy.SignInToPortal("notebook")

which is analogous to GIS("home") for ArcGIS API for Python.

Please let me know if you have additional questions.

thanks,

Nick Giner (nginer@esri.com)

0 Kudos
DonMorrison1
Frequent Contributor

Thanks Nick. I did a quick test and it didn't seem to work as I expected. It's going to take me a week or so to get back and dig in deeper. I'll let you know what I find out

0 Kudos