Select to view content in your preferred language

Issue with url declared in python

265
1
04-04-2025 09:19 AM
HamzaMerini
Occasional Contributor

Hello,

I created a custom geoprocessing tool in Pro using a python script & tested it (of course) which works perfectly when I launch the script from ArcGIS 
I published this tool so I can use it using the REST API

The issue I'm facing is when I launch the GP TOOL from the REST API the URL that I set in the script is switched to a path :

LAYER_URL = r"https://gisdata.xyzxy/arcgis/rest/services/ServiceA/FeatureServer/0"
arcpy.AddMessage(f"Layer URL: {LAYER_URL}")


This is what I get in the job Messages 

HamzaMerini_0-1743783325347.png


For some reason the URL is switched to a path and therefore I get an error when I want to access to the feature layer

feature_layer = FeatureLayer(featureLayerUrl, gis)


Do you know why is this happening ? And how can I force the script to keep the URL that I provided ?

Thank You !


Tags (3)
0 Kudos
1 Reply
DavidPike
MVP Notable Contributor

Have you tried a FeatureSet?

feature_set = arcpy.FeatureSet()
feature_set.load("url.../FeatureServer/0")
0 Kudos