AnsweredAssumed Answered

JSONDecodeError When Accessing a Feature Layer

Question asked by jrmatchett on Feb 24, 2020
Latest reply on Feb 25, 2020 by bixb0012

I'm trying to query a particular feature layer (https://www.visalia.city/server/rest/services/OpenData/CurrentAddresses/FeatureServer/0)

but receive a JSONDecodeError. Here's my code and result:

from arcgis.features import FeatureLayer

adds_layer = FeatureLayer('https://www.visalia.city/server/rest/services/OpenData/CurrentAddresses/FeatureServer/0')

adds = adds_layer.query()

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/jrmatchett/opt/anaconda3/envs/arcgis17/lib/python3.7/site-packages/arcgis/features/layer.py", line 1019, in query
    record_count = self._query(url, params, raw=as_raw)
  File "/Users/jrmatchett/opt/anaconda3/envs/arcgis17/lib/python3.7/site-packages/arcgis/features/layer.py", line 1960, in _query
    raise queryException
  File "/Users/jrmatchett/opt/anaconda3/envs/arcgis17/lib/python3.7/site-packages/arcgis/features/layer.py", line 1930, in _query
    postdata=params, token=self._token)
  File "/Users/jrmatchett/opt/anaconda3/envs/arcgis17/lib/python3.7/site-packages/arcgis/gis/__init__.py", line 10101, in _token
    self._hydrate()
  File "/Users/jrmatchett/opt/anaconda3/envs/arcgis17/lib/python3.7/site-packages/arcgis/gis/__init__.py", line 10071, in _hydrate
    self._refresh()
  File "/Users/jrmatchett/opt/anaconda3/envs/arcgis17/lib/python3.7/site-packages/arcgis/gis/__init__.py", line 10038, in _refresh
    raise e
  File "/Users/jrmatchett/opt/anaconda3/envs/arcgis17/lib/python3.7/site-packages/arcgis/gis/__init__.py", line 10033, in _refresh
    dictdata = self._con.post(self.url, params, token=self._lazy_token)
  File "/Users/jrmatchett/opt/anaconda3/envs/arcgis17/lib/python3.7/site-packages/arcgis/_impl/connection.py", line 1148, in post
    resp_json = json.loads(resp_data)
  File "/Users/jrmatchett/opt/anaconda3/envs/arcgis17/lib/python3.7/json/__init__.py", line 348, in loads
    return _default_decoder.decode(s)
  File "/Users/jrmatchett/opt/anaconda3/envs/arcgis17/lib/python3.7/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/Users/jrmatchett/opt/anaconda3/envs/arcgis17/lib/python3.7/json/decoder.py", line 355, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

I can access and query the layer just fine via its webpage or when adding it to a web map. Accessing some other feature layer properties, such as properties and metadata, generates the same error. I experience the issue when using either versions 1.6.2 or 1.7.1 of the arcgis python API.

Outcomes