Trying to change culture (en-US, etc) of users in Portal via Python

595
1
07-19-2021 08:56 AM
Labels (1)
IanHand
New Contributor

Hi,

 

I am trying to change the culture (en-GB, etc) for users in our Portal via Python. We found that a global change via the organization settings does not hold for existing users. My attempted code is the following:

 

from arcgis.gis import GIS

portal = GIS(url="my_portal.com", username="my_username", password="my_password")

users_list = portal.users.search(query=" ", max_users=10000)

for i in users_list:
user = i
user_name = user.username
user_culture = user.culture
if user_culture == "en-US":
new_culture = user_culture.replace('en-US', 'en-GB')
user.update(user={"culture": new_culture})
print(user_name, ',', user_culture)

 I am met with the following error:

Traceback (most recent call last):
File "path_to_python_script", line 19, in <module>
user.update(user={"culture": new_culture})
TypeError: update() got an unexpected keyword argument 'user'

 

Thanks in advance.

 

0 Kudos
1 Reply
SzuNyiapTang
Esri Contributor

Hi Ian,

You can just remove the user= in the syntax.

user.update(user={"culture": new_culture})

 Cheers,

Tang

Cheers,
Tang
0 Kudos