I'm trying to use a web geoprocessing service in python. I'm using the example in this web site http://resources.arcgis.com/en/help/main/10.1/index.html#/Using_a_geoprocessing_service_in_Python_scripts/00570000004w000000/
I'm not getting the expected results does anyone know the proper syntax to submit a job to a geoprocessing service?
Here's my code:
import arcpy,urllib,json baseURL = "my service here" query = "?Address:=504 Walnut St & RecType: = Youth Baseball League?" submitResponse = urllib.urlopen(baseURL+query) submitResponse = urllib.urlopen(baseURL+query) jobUrl = submitResponse.geturl() status = "esriJobSubmitted" print jobUrl while status == "esriJobSubmitted" or status == "esriJobExecuting": #print "checking to see if job is completed..." time.sleep(1) jobResponse = urllib.urlopen(jobUrl, "f=json") jobJson = json.loads(jobResponse.read()) if 'jobStatus' in jobJson: status = jobJson['jobStatus'] if status == "esriJobSucceeded": if 'results' in jobJson: resultsUrl = jobUrl + "/results/" resultsJson = jobJson['results'] for paramName in resultsJson.keys(): resultUrl = resultsUrl + paramName print resultUrl resultResponse = urllib.urlopen(resultUrl, "f=json") resultJson = json.loads(resultResponse.read()) print resultJson['value'] print resultJson if status == "esriJobFailed": if 'messages' in jobJson: print jobJson['messages'] else: print "no jobId found in the response" print "no jobId found in the response"
Message was edited by: Wes Miller