Example of GPObject in Action:
import arcrest
# convert a feature class to a GPFeatureRecordSet
gpfrs = arcrest.ags.GPFeatureRecordSetLayer.fromFeatureClass(r"c:\temp\grid.gdb\sample", paramName="parameterName on GP tool")
Working with GP services is easy as well.
Example:
import arcrest
if __name__ == "__main__":
sh = arcrest.AGSTokenSecurityHandler(username="user",
password="password",
token_url="http://site:6080/arcgis/admin/generateToken"
)
url = "http://site:6080/arcgis/rest/services/gp/scriptmv/GPServer"
gp = arcrest.ags.GPService(url=url,
securityHandler=sh)
for task in gp.tasks:
if task.name.lower() == "":
# submit the job
job = task.submitJob(inputs=None)
# wait till the job finishes
while job.jobStatus != "esriJobSucceeded": pass
# get the job results
results = job.results # do something here.
Here we accessed a GP service and found a tool we wanted to run. Since we are running the process async, submitJob() was used. The function has additional options, like submitting the result via POST verse GET, etc...
Enjoy