Stuck on a problem and need help troubleshooting a script I wrote to bulk-create users from a CSV file using the Genesys Cloud Platform SDK for Python.
I’m running this on macOS 14.2 with genesys-cloud-platform-client==128.0.0. The goal is to parse a CSV, validate the data, and push user objects to the API. Here is the core loop:
from genesyscloud.platform.client import ApiClient
from genesyscloud.users.api import UsersApi
from genesyscloud.users.model import User
client = ApiClient(...)
users_api = UsersApi(client)
for row in csv_data:
user_body = User(
email=row['email'],
name=row['name'],
username=row['username']
)
try:
users_api.post_users(body=user_body)
except Exception as e:
print(f"Failed for {row['username']}: {e}")
The script works for the first 50-60 users, then I start seeing 429 Too Many Requests errors. I know the API has rate limits, but the SDK doesn’t seem to have a built-in retry or sleep mechanism for bulk operations. I’ve tried adding a time.sleep(1) but it feels brittle.
Is there a recommended pattern in the Python SDK for handling bulk creates, or should I implement my own exponential backoff logic? Also, does the SDK support batch endpoints for users, or is individual POST the only way?