After upgrading my ArcGIS Pro to 3.4 the Service class from the arcgis.gis.server module is gone. What has happened to it? In the documentation the Service section is still there, but nothing underneath that.
Solved! Go to Solution.
Prior to version 2.4 of the ArcGIS API for Python, you used to be able to see the Service class directly with something like
from arcgis.gis import server
server.Service
Starting at 2.4, you can't do that anymore, but the object itself still exists and can be used. I think the recommended way to get access to it is through the admin property of the gis object. So it should look something like:
# Connect to portal
from arcgis.gis import GIS
gis = GIS(<credentials>)
# Create Server object from list of servers
server = gis.admin.servers.list()[0]
# Create Service object from list of services
service = server.services.list()[0]
If you check the type of `service` in this case, it should be `arcgis.gis.server.admin._services.Service`, which is the same type as it was in prior versions of the Python API. From a quick glance it looks like it has all the same properties and methods as the older versions of the class. If you're looking for documentation on its behavior, you could either use the 2.3 version of the API doc or call the help function on `arcgis.gis.server.admin._services.Service`.
I didn't see the behavior documented in the 2.4 version of the API reference, so I also submitted feedback on the documentation so that it could be recorded there.
Prior to version 2.4 of the ArcGIS API for Python, you used to be able to see the Service class directly with something like
from arcgis.gis import server
server.Service
Starting at 2.4, you can't do that anymore, but the object itself still exists and can be used. I think the recommended way to get access to it is through the admin property of the gis object. So it should look something like:
# Connect to portal
from arcgis.gis import GIS
gis = GIS(<credentials>)
# Create Server object from list of servers
server = gis.admin.servers.list()[0]
# Create Service object from list of services
service = server.services.list()[0]
If you check the type of `service` in this case, it should be `arcgis.gis.server.admin._services.Service`, which is the same type as it was in prior versions of the Python API. From a quick glance it looks like it has all the same properties and methods as the older versions of the class. If you're looking for documentation on its behavior, you could either use the 2.3 version of the API doc or call the help function on `arcgis.gis.server.admin._services.Service`.
I didn't see the behavior documented in the 2.4 version of the API reference, so I also submitted feedback on the documentation so that it could be recorded there.
Thanks for the answer @TravisOrmsby 🙂