Select to view content in your preferred language

ArcPy code to consume a GpService in Python

237
2
09-05-2024 11:36 AM
SanchezNuñez
Frequent Contributor

Good afternoon,

I am looking for samples that explain how to consume a GPService using with Pyhthon and ArcPy.

The GPService has  an input text field and returns a feature class.

How do I pass a value in input and get the output?

Thanks

 

 

 

0 Kudos
2 Replies
DavidSolari
Frequent Contributor

The Import Toolbox docs has a section on how you have to format your toolbox URL to load it into arcpy. Note that for most services, you can't just call the tool function and then move on, you have to spin loop over the "status" property of the result object that's returned until you get one that lets you proceed, the docs have more info.

0 Kudos
SanchezNuñez
Frequent Contributor

Hi @DavidSolari ,

I was able to test my GPService with an ArcPy Python script. I had a big issue, because the name of the task, is not the same in the server and in the python script. This is why the script was failing. But not it works.

 

I recommend to use ChatGPT  and type "how to consume a  geoprocessing service using arcpy" the sample I got was very good.

 

Thanks

 

 

0 Kudos