Running to another roadblock playing around with this API.
This gets me a list of servers nicely...
gis_servers = gis.admin.servers.list()
This gets me at the server I want...
dev = gis_servers[0]
This validates to True nicely..
gis.admin.servers.validate()
I can check if a service exists...
>>> dev.services.exists("rwpc", "rwpc_auditissues", "MapServer")
True
but this returns an empty list?
>>> dev.services.list()
[]
I need the list to get the service object, so I can start, stop, delete, etc.
Anyone see this on thier end?
I have a freshly upgraded API and am connected with an Admin account.
Thanks in advance....again.
James
What version of Server/Portal are you using?
Thanks
10.4.1
In 10.6 calling the list throws an exception
agsServiceManager=agsServer.services
agsServiceManager.list()
Traceback (most recent call last):
File "C:\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\server\_common\_base.py", line 83, in __getattr__
return self._properties.__getitem__(name)
File "C:\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\_impl\common\_mixins.py", line 340, in __getitem__
return self._mapping[key]
KeyError: '_services_list'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\server\admin\_services.py", line 124, in list
return self._services_list
File "C:\ArcGIS\Pro\bin\Python\envs\arcgispro-py3\lib\site-packages\arcgis\gis\server\_common\_base.py", line 88, in __getattr__
raise AttributeError("'%s' object has no attribute '%s'" % (type(self).__name__, name))
AttributeError: 'ServiceManager' object has no attribute '_services_list'
This issue was fixed in version 1.3 (released in mid Dec 2017). Could you upgrade the arcgis package and try again? Install and set up | ArcGIS for Developers
Wonderful Atma Mani, that seems to have worked, took me some time to get upgraded to 1.3, had to do a manual install:)