-1
If anyone can help me.. I have a Python script that reads a file. json that contains the web services I need to interact with. At first, my json only needed to contain a service and the script works smoothly, but now I need this json to receive more services. How could I get the . py file to run the first service and then the second, third.... until I finish the list?
Code . json
{
"service":[
{
"portalURL":"URL PORTAL WEB",
"fsURL":"URL serviço WEB",
"fsLayerNum":0,
"serviceuser":"Minha conta",
"servicepw":"Minha senha",
"fieldstoreport":["*"],
"viewerMapLevel":19
},
{
"portalURL":"URL PORTAL WEB",
"fsURL":"URL serviço WEB",
"fsLayerNum":0,
"serviceuser":"Minha conta",
"servicepw":"Minha senha",
"fieldstoreport":["*"],
"viewerMapLevel":19
}
],
"filenames":{
"lasteditfile":"lastedit.json"
}
}
File step . py currently reading the first service contained in . json.
fsurl = cfg['service']['fsURL']
if fsurl[-1] == '/':
urlLyr = '{}{}'.format(fsurl, cfg['service']['fsLayerNum'])
else:
urlLyr = '{}/{}'.format(fsurl, cfg['service']['fsLayerNum'])
portalURL = cfg['service']['portalURL']
if portalURL[4] == ':':
portalURL = portalURL.replace(':', 's:')
viewerurl = '{}/home/webmap/viewer.html'.format(portalURL)
sharingurl = '{}/sharing'.format(portalURL)