Unable to update / delete user in ArcGIS Python API - HTTP 404 error

612
15
02-03-2020 05:20 AM
PhillipGiraud
New Contributor II

I am trying to update a user's description in our ArcGIS Portal instance but the below code is giving me an HTTP 404 error:

from arcgis.gis import GIS

gis = GIS("my_portal_url", "my_user", "my_password")
user = gis.users.get(username="chris.buckmaster")
user.update(description="Chris's Bio")

The error I receive is as follows:

Traceback (most recent call last):
File "test.py", line 5, in <module>
user.update(description="Chris's Bio")
File "C:\ProgramData\Anaconda3\lib\site-packages\arcgis\gis\__init__.py", line 5700, in update
files=files)
File "C:\ProgramData\Anaconda3\lib\site-packages\arcgis\_impl\connection.py", line 1107, in post
resp = opener.open(url, data=encoded_postdata.encode())
File "C:\ProgramData\Anaconda3\lib\urllib\request.py", line 531, in open
response = meth(req, response)
File "C:\ProgramData\Anaconda3\lib\urllib\request.py", line 641, in http_response
'http', request, response, code, msg, hdrs)
File "C:\ProgramData\Anaconda3\lib\urllib\request.py", line 569, in error
return self._call_chain(*args)
File "C:\ProgramData\Anaconda3\lib\urllib\request.py", line 503, in _call_chain
result = func(*args)
File "C:\ProgramData\Anaconda3\lib\urllib\request.py", line 649, in http_error_default
raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 404:

I can connect fine to the Portal and have been able to extract data out and produce reports etc so I am wondering why I might be receiving this error? I am using v1.6 of the ArcGIS Python API and Portal v10.6.

I am connecting as an administrator account so have full privileges.

Thanks

0 Kudos
15 Replies
JakeSkinner
Esri Esteemed Contributor

Hi Phillip,

I was able to run this code using v1.7 of the ArcGIS for Python API and Portal 10.7.1.  I would try upgrading the API:

  1. Start > ArcGIS > right-click Python Command Prompt > Run As Administrator
  2. Execute the following:  conda upgrade -c esri --no-pin arcgis
0 Kudos
PhillipGiraud
New Contributor II

Hi Jake

I have tried to upgrade to version 1.7 in the past but it just doesn't seem to be an option (have tried using the --no-pin command as well which I hadn't done before but it still doesn't give me the option to upgrade to 1.7).

I have checked the differences between 1.6 and 1.7 for this function and it is exactly the same so I am not sure whether an upgrade would help, but wouldn't have thought it is an issue with the API seeing as I can perform the other operations?

0 Kudos
JakeSkinner
Esri Esteemed Contributor

What version of ArcGIS Pro do you have installed (i.e. 2.4.3)?

0 Kudos
PhillipGiraud
New Contributor II

Version 2.2.0 but I don't use the software.

0 Kudos
ChrisBuckmaster2
New Contributor III

Any further ideas?

0 Kudos
JakeSkinner
Esri Esteemed Contributor

I would focus on upgrading to version 1.7 of the API.  If it's still an issue, then it could be related to the release of Portal for ArcGIS.

0 Kudos
ChrisBuckmaster2
New Contributor III

Hi Jake

I get the below message when trying to upgrade, it seems to not recognise there being an option to upgrade to a newer release.

I'm not sure why it would be related to the release of ArcGIS Portal, as doesn't it get installed independent from any Portal environment?

0 Kudos
JakeSkinner
Esri Esteemed Contributor

Do you receive the same error when you run the above from C:\Program Files\ArcGIS\Pro\bin\Python\envs\arcgispro-py3?

0 Kudos
ChrisBuckmaster2
New Contributor III

Yes...

0 Kudos