Hi everyone,
I'm trying to piece this process together, but can anyone point me in the direction on how to publish a python script tool to ArcGIS Server as a geoprocessing service for the purpose of using it within the geoprocessing widget in ArcGIS Web App Builder? The script tool runs successfully within Pro, but ideally I would like to use it within an existing Web App Builder application. The script tool uses an input polygon layer, which has a URL link to a pdf document for each polygon record. Within ArcGIS Pro and after selecting polygons, the tool will output the pdf documents to a specified output folder (technically an input parameter). Assuming that this tool can be published as a geoprocessing service, how would the user select polygons within the web app builder application or geoprocessing widget? Below is the python code for the for the tool as well as a snip of the tool in ArcGIS Pro and a list of its parameters. Any help or guidance on this subject would be greatly appreciated!
import arcpy
import os
import requests
fc = arcpy.GetParameterAsText(0)
dest_path = arcpy.GetParameterAsText(1)
print(fc)
cursor = arcpy.SearchCursor(fc)
with arcpy.da.SearchCursor(fc, ['LINK']) as cursor:
for row in cursor:
print("Downloading: " + row[0])
response = requests.get(row[0])
outputFile = row[0].split("/")[5]
print(outputFile)
with open(dest_path + '\\' + outputFile, 'wb') as f:
print(f)
f.write(response.content)
del cursor
Hi
You need to publish the tool to the server to make it gp service.
You have some issue with such a script as a service.
Does the server (and the user that runs it) have access to the fc and dest_path?
Using gp services need some thinking about access rights and multiple requests from different users