I have access to a ArcGIS REST API service running on a standalone, unfederated ArcGIS Server. (Not AGOL or ArcGIS Enteprise) ie (https://xxxx.xxxxx.com/arcgis/rest/services/xxxxxx/xxxxMap/MapServer)
Is there any way to consume the REST API services like MapServers, ImageServers using ArcGIS's Python API?
Also, I am working in a secured environment with no internet access. Using MapImageLayer from ArcGIS's Python API forces a GIS object as a parameter by default. And that GIS object calls out to www.arcgis.com for anonymous authentication.
1 Answer 1
It is possible to get to the feature services in a standalone server by using the arcgis.server.Server
class.
See the doc and tech article here:
Python API (server submodule) https://developers.arcgis.com/python/api-reference/arcgis.gis.server.html#arcgis.gis.server.Server
Access items ... standalone server https://support.esri.com/en/technical-article/000021795
Here is a snippet to get access to a FeatureLayerCollection directly from the server instead of the portal.
from arcgis import *
from arcgis.gis import server
server_base_url = "https://servername.esri.com"
gis_server = server.Server(url=f"{server_base_url}/web_adaptor/admin",
token_url=f"{server_base_url}/web_adaptor/tokens/generateToken",
username="username",
password="pass.word")
content_dir = gis_server.content
service = content_dir.get("lsa_testing_feet")
print(type(service))
>>> <class 'arcgis.features.layer.FeatureLayerCollection'>
Explore related questions
See similar questions with these tags.