What is the right way to handle rate limits when bulk creating users with the Genesys Cloud Python SDK?
I have a CSV file with about 200 new users. I’m reading it in with pandas and looping through to call platform_client.users_api.post_users(). The first 20 or so go through fine. Then it starts failing with 429 Too Many Requests.
Here is the loop:
for index, row in df.iterrows():
user_body = models.PostUsersRequestBody(
name=row['Name'],
email=row['Email'],
username=row['Email'],
addresses=[models.PostAddressItem(type='work', phoneNumber=row['Phone'])]
)
try:
api_response = platform_client.users_api.post_users(body=user_body)
print(f"Created user {row['Name']}")
except ApiException as e:
print(f"Status {e.status}")
time.sleep(2)
The sleep helps a bit but it’s still hitting the limit. The docs say the limit is 60 requests per minute for this endpoint. Should I be using a different method? Is there a batch endpoint I’m missing? The SDK doesn’t seem to have a built-in retry mechanism that handles the specific backoff strategy needed here. I just want to get this script to run without manual intervention. It feels like I am reinventing the wheel here.