AnsweredAssumed Answered

Request data from ArcGIS Server through python

Question asked by shawn.hibbs_Hydromax on Sep 8, 2017
Latest reply on Sep 12, 2017 by JQuinn-esristaff

I am having an issue when trying to create a script that will return a list of values from an ArcGIS Server service from a json query in python. I have the following code below which I thought would do the trick but it returns the HTML and not the json results as I was hoping. Could someone please help to let me know what I'm doing wrong?

 

import requests, json

inFeatures = "http://wildfire.cr.usgs.gov/arcgis/rest/services/geomac_dyn/MapServer/0/query"
json_payload = { 'where': 'acres > 5','f': 'json', 'outFields': 'latitude,longitude,incidentname,acres'}
r = requests.get(inFeatures, params=json_payload)
print r.text

Outcomes