1

Using ArcGIS API for Python on Portal, I need to see

from arcgis.gis import GIS
gis = GIS(url="https://xxx.xxx.com/portal", username="xxx", password="xxx")
print(gis.version)
user = gis.User('[email protected]')
print(user.fullName)

But I am getting this error on print(user.fullName)

AttributeError: 'GIS' object has no attribute 'User'

while the arcgis.gis module has a class for User at Here

enter image description here

1 Answer 1

1

User is a class in the arcgis.gis module, not a property of the arcgis.gis.GIS class.

The examples show a couple of ways of getting a User object:

from arcgis.gis import GIS, User

url="https://xxx.xxx.com/portal"
username="xxx@xxx"
password="xxx"

gis = GIS(url=url, username=username, password=password)

# Ask the GIS object for a User
user = gis.users.get(username)
print(user.fullName)

# Get the User directly
user = User(gis, username)
print(user.fullName)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.