Getting error while searching for portal users in PortalPy

2533
11
Jump to solution
09-04-2016 05:50 PM
GregStevenson
New Contributor III

I am using PortalPy to search for and return users. I am getting the following error:

'NoneType' object has no attribute 'get'

I get the error whether I use 'search_users' or 'get_org_users'

The error only occurs when I attempt to return all users. If I search for a specific user or set of users they return fine. My code is:

portal = portalpy.Portal(portalUrl, portalAdminUser, portalAdminPassword)
users = portal.search_users('')

print(users)

Any thought as to what the cause is? There are no obvious problems with our portal users that would make them None objects. The same code worked previously.

Also possibly related is this new message when the script is run "No handlers could be found for logger "portalpy""

Tags (3)
0 Kudos
11 Replies
JonathanQuinn
Esri Notable Contributor

The request for users that it makes is:

<portalUrl>/sharing/rest/community/users?q=accountid%3A0123456789ABCDEF

The user search endpoint, (sharing/rest/community/users) does not need a token, so it doesn't actually use the credentials provided to generate a token.  It returns very basic information about the users within the organization.  If you were to make that request with a token, you'd get more information.

PaulDavidson1
Occasional Contributor III

Thanks for the clarification Jonathan.

I'm wondering if this represents a minor security breach? 

For example, I can get to the query page without any login, which matches your clarification.

But then I can do a query on 'd*' and get back names with a d in them.

Since Portal is typically inside the firewall, maybe it's no big deal. 

What is the design purpose of the sharing directory?

Thanks...

0 Kudos