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
If you make that request manually in your browser, some sort of token is attached to the request:
Since you're not submitting the request with that token, it redirects you to an HTML page.