AnsweredAssumed Answered

Remove Portal user via ArcGIS REST API with Python without arcgis module

Question asked by fimpe0011 on Jun 20, 2018
Latest reply on Jun 20, 2018 by JQuinn-esristaff

I want to use Python without needing to load the arcgis module (mainly to keep licensing simpler) to remove a Portal user account. It seems like a call to http:// <portal-url>/removeusers as described here should be easy enough to make. But I can't get it to actually work. Can somebody provide an example?

 

Here is the function I have, based on a number of somewhat similar examples I found online.

def removeUser (token,portalUrl,username)
    params = urllib.urlencode({'token' : token,'f' : 'json','users' : username})
    response = json.loads(urllib.Request(portalUrl + '/removeusers?', params, { 'Referer' : portalUrl }).read())

The error I get is "AttributeError: read" .

Outcomes