agrc / masquerade

Disguise UGRC's Web API endpoints as an Esri locator service.
https://github.com/agrc/masquerade#readme
MIT License
1 stars 0 forks source link

'int' object is not subscriptable when geocoding #153

Closed steveoh closed 11 months ago

steveoh commented 11 months ago

Given this input

https://masquerade.ugrc.utah.gov/arcgis/rest/services/UtahLocator/GeocodeServer/findAddressCandidates?f=json&outFields=*&singleline=Choi’s-2&Single Line Input=Choi’s-2&outSR=4326&langCode=en&location={"x":-111.899,"y":41.0122,"spatialReference":{"wkid":4326}}&maxLocations=6

This error was thrown

request_wkid = json.loads(incoming_request.args.get(out_sr_param_name))["wkid"]
TypeError: 'int' object is not subscriptable

If I follow what's going on here, it's looking at the outSR parameter of 4326 but assuming it's a json object like

{"spatialReference":{"wkid":4326}}

which it's not. So does the code need to handle both instances of the full object or the shorthand int version of wkid?