I am trying to figure out the right way to get arcpy.da.searchcursor working with an ArcGIS Online service that is not public. I have the service shared to an ArcGIS Online group and my user is a member of the group.
I know I can use arcpy.SignInToPortal to sign into portal with my user and then I think arcpy.GetSigninToken() to get the token from that sign in.
I tried adding the token as a parameter to the service url but that didn't seem to work.
Has anyone successfully used arcpy.da.searchcursor with an AGO non-public service?
It might help for you to explain what you are trying to accomplish or what your goal is. This will help us guide you in the correct direction.
When interacting with ArcGIS online hosted services we use REST. ESRI has created an awesome API for us to use that wraps REST in python. It is called the ArcGIS API for Python. I highly recommend that you take a look at the API and some of the tutorials.
You can access the API reference from here:
Here you can access the guide for the API. Take a look at the getting started section. This will help you login to ArcGIS Online VIA python and help you get going on your journey.
Once you have familiarized your self with the ArcGIS API for Python. You want to take a look at the arcgis.features module. This module will allow you to work with the data in the hosted feature service. You can do things like access fields, properties, update, add data, delete data, append, calculate and more. Within the arcgis.features module there is a class called the FeatureLayer Class. You can directly query features with this class.
If you have any questions, please do not hesitate to ask. There are no dumb questions.
Hope this helps
Thank you for replying. My goal is to download records from an ArcGIS Online Hosted service using the arcpy searchcursor method. I am aware of the ArcGIS Python API. We do use that. Unfortunately, we started having some intermittent issues with the query so I temporarily switched to using arcpy searchcursor to get records.
So I am trying to find out the correct way to use arcpy searchcursor with a non-public ArcGIS Online hosted service.