Querying restricted FeatureLayer in v 1.8.1 returns JSON decode error (BUG)

159
3
2 weeks ago
Highlighted
Occasional Contributor III

This error / bug does not occur in version 1.7.0.  

To reproduce:

 

from arcgis.gis import server
from arcgis.features import FeatureLayer
gis = server.Server(serverAdminEndpoint, username=username, password=password, verify_cert=False)
fl = FeatureLayer(restrictedFeatureLayerUrl, gis=gis)
features = fl.query()

 

The last line generates a JSON Decode error.  

I've tried various parameters in the fl.query (e.g., as_df, outFields, returnGeometry, etc. etc.) and nothing seems to work.  This code was working as 1.7.0, and when I downgraded by arcgis version to 1.7.0 on the same environment that had been generating the error, the code worked.  

Reply
0 Kudos
3 Replies
Highlighted
Esri Contributor

Hi @Jay_Gregory ,

I tested the code in 1.8.2 and it's working fine. I can recommend to upgrade to ArcGIS API for Python 1.8.2:

 

from arcgis.gis import server
from arcgis.features import FeatureLayer

gis = server.Server("server url/hosting/admin", username="username", password="password", verify_cert=False)

fl = FeatureLayer("your_ent_admin_profile", gis=gis)
features = fl.query(where='1=1', out_fields='location, rating',)
features

 

<FeatureSet> 7 features

 

features.sdf

 

MehdiPira1_0-1605574851099.png

 

 
 
 

 

 

Tags (1)
Reply
0 Kudos
Highlighted
Occasional Contributor III

Thanks - I've tested with a different service on a different ArcGIS Enterprise and this seems to be being caused by a different issue altogether, perhaps how the Server is setup, since it is not federated with Portal.  Testing with a different service worked, but upgrading to 1.8.2 and testing with the original service still gave the same error.  Unclear why 1.7.0 doesn't give this error, but will continue digging.  

Highlighted
Esri Contributor

Not a problem, @Jay_Gregory .

Reply
0 Kudos