Paging Alex Tereshenkov! I'm trying to run your script located here:
Get data sources that are used by ArcGIS Server map services with Python | Tereshenkov's Blog
but I'm getting an error when I get to here:
def get_connection(data):
'''return database connection string for the service'''
return data['SVCManifest']['Databases']['SVCDatabase']['OnPremiseConnectionString']
Error:
TypeError: list indices must be integers, not str
Any ideas? This looks very useful!
Does the service have multiple layers using different connections? I'm not sure of the format of the JSON that's returned, but there's a list somewhere in there that you'll need to loop through. I would print the data variable and see what it stores.
Hello, I am also having this problem. I with some help I have found that return data['SVCManifest']['Databases']['SVCDatabase'][0]['OnPremiseConnectionString'] works. Note [0] is the first in a list. Does any have code to loop through it?