List of all NU and their storageusage by arcgis.gis.User

268
1
03-13-2019 12:28 AM
MichaelMarz
New Contributor II

Hello everyone!

I would like to create an overview of all Named User and their related attributes as provided with this module:
class arcgis.gis.User(gis, username, userdict=None)

My script is as following

import pandas as pd
import numpy as np
from arcgis.gis import GIS
import arcgis

gis = GIS("*arcgis online subscription url", "*my user*", "*my password*")

my_user_list = arcgis.gis.User(gis, "*my user*", userdict=None)
print(my_user_list)
<User username:*my user*>


I have two problems:
1.) I expected an full output as dictionaty as described in the reference.
2.) How can I print a list of all NU with the attributes? The class expect a specific user.

Thank you in advance.

Tags (3)
0 Kudos
1 Reply
FFSL_-_JustinJohnson
New Contributor III

It looks like you may be using the wrong method.  Are you attempting to list all users in your organization and some of their attributes?  To do that, you could use something like this:

from arcgis.gis import GIS


gis = GIS("https://www.arcgis.com", username="---", password="---")
userlist = gis.users.search()

for user in userlist:
print("{:<48s}".format(user.fullName), "{:<24}".format(user.email))‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

This will print the user's name and email address, in two evenly spaced columns.  You can add more attributes to that output by using the user['key'] or user.key methods that you would use in a dictionary. 

0 Kudos