Trying to script a bulk import of users from a CSV into Genesys Cloud using the Python SDK. We’re moving some agents over and doing this manually in the admin console is painful.
I’ve got the OAuth part sorted. The script reads the CSV, maps the columns to the CreateUserRequest object, and loops through to call users_api.post_users. It works fine for 10 users. But when I hit 50, the script just hangs or throws a generic connection error.
Here’s the loop:
for row in reader:
user = models.CreateUserRequest(
name=row['name'],
email=row['email'],
username=row['username'],
password=row['password'],
user_type='agent'
)
try:
api_instance.post_users(body=user)
except Exception as e:
print(f'Failed: {e}')
The error is usually urllib3.exceptions.MaxRetryError. I’m assuming I’m hammering the API too hard. Should I be using batch endpoints? I can’t find a bulk user creation endpoint in the docs. Is there a better way to handle this in the SDK or should I just add sleep? It’s blocking our migration timeline.