Encountering inconsistent error with GIS.users.search()

158
0
08-18-2021 01:24 PM
StephenButcher
New Contributor

Good day,

We are encountering sporadic errors with querying users by role from ArcGIS. The error message we get is:

Traceback (most recent call last):
  File "//./ArcGISCreditsAllocation.py", line 344, in <module>
    users = gisConn.users.search(query=f"role: {roleId}",max_users=5000)
  File "/usr/local/lib/python3.9/site-packages/arcgis/gis/__init__.py", line 3775, in search
    userlist.append(User(self._gis, un))
  File "/usr/local/lib/python3.9/site-packages/arcgis/gis/__init__.py", line 8357, in __init__
    if hasattr(self, "id") and self.id != "null":
  File "/usr/local/lib/python3.9/site-packages/arcgis/gis/__init__.py", line 8377, in __getattr__
    self._hydrate()
  File "/usr/local/lib/python3.9/site-packages/arcgis/gis/__init__.py", line 8366, in _hydrate
    userdict = self._portal.get_user(self._user_id)
  File "/usr/local/lib/python3.9/site-packages/arcgis/gis/_impl/_portalpy.py", line 1279, in get_user
    return self.con.post("community/users/" + username, self._postdata())
  File "/usr/local/lib/python3.9/site-packages/arcgis/gis/_impl/_con/_connection.py", line 1041, in post
    return self._handle_response(
  File "/usr/local/lib/python3.9/site-packages/arcgis/gis/_impl/_con/_connection.py", line 585, in _handle_response
    data = resp.json()
  File "/usr/local/lib/python3.9/site-packages/requests/models.py", line 910, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/local/lib/python3.9/json/__init__.py", line 346, in loads
    return _default_decoder.decode(s)
  File "/usr/local/lib/python3.9/json/decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/local/lib/python3.9/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)


This error has occurred twice in the last 24 hours, but this script runs every 10 minutes, so I'm assuming there is a server side error that is not being cleanly handled?

Any insight would be greatly appreciated.

Tags (1)
0 Kudos
0 Replies