Python SDK Bulk User Creation: Rate Limiting and CSV Parsing Issues

We’ve been trying to automate user onboarding by reading a CSV file and creating users in bulk using the Genesys Cloud Python SDK. The idea is straightforward: read the rows, map them to the User model, and call the post_users method. But we’re hitting a wall with 429 Too Many Requests errors after about 15 users.

Here’s the gist of the loop:

for row in csv_data:
 user_body = {
 'name': row['name'],
 'email': row['email'],
 'username': row['username'],
 'password': row['password'],
 'roles': [{'id': 'some-role-id'}]
 }
 try:
 api_response = users_api.post_users(body=user_body)
 print(f"Created user {api_response.id}")
 except ApiException as e:
 print(f"Error creating user: {e.status} - {e.reason}")

The 429s are expected, but the retry logic feels clunky. We’re manually adding a time.sleep() which slows everything down unnecessarily. Is there a built-in way in the Python SDK to handle rate limiting gracefully, or should we be looking at a different approach for bulk operations? Also, some users are failing with 400 Bad Request due to duplicate emails, but the error message isn’t very clear. Any tips on handling these errors more cleanly?