Select to view content in your preferred language

Get data sources that are used by ArcGIS Server map services with Python (Alex Tereshenkov)

1502
2
12-01-2016 03:00 PM
KevinBell
Deactivated User

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!

Tags (3)
0 Kudos
2 Replies
JonathanQuinn
Esri Notable Contributor

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.

by Anonymous User
Not applicable

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?

0 Kudos