Yesterday it was running fine in Jupyter Notebook, took 15 seconds. Today it's up to 4 minutes so far.
From this post https://community.esri.com/t5/arcgis-api-for-python-questions/folders-key-error-on-servicesdirectory...
it looks like the call was put in there only for internal use and I should not call it?? If true, I wonder if you could add that to the docs, Esri??
from arcgis.gis.server.catalog import ServicesDirectory
sd = ServicesDirectory(url="https://xxxxx/server",username="user",password="pass")
sd.list()
If I call sd.list(folder="My Folder") then it works like a charm.
Solved! Go to Solution.
For anyone searching for how to use ServicesDirectory, don't, it does not work correctly. Use something like this, it's fast and it works.
from arcgis.gis import GIS
print(arcgis.__version__)
gis = GIS(url="https://xxx/portal",username="xxx",password="xxx")
myservers=gis.admin.servers.list()
services = myservers[0].services.list()
for s in services:
print(s.iteminformation.properties)
For anyone searching for how to use ServicesDirectory, don't, it does not work correctly. Use something like this, it's fast and it works.
from arcgis.gis import GIS
print(arcgis.__version__)
gis = GIS(url="https://xxx/portal",username="xxx",password="xxx")
myservers=gis.admin.servers.list()
services = myservers[0].services.list()
for s in services:
print(s.iteminformation.properties)