Python SDK bulk user creation from CSV hitting 429 Rate Limit

Trying to script a bulk user import from a CSV using the Python Platform SDK. We’ve got about 500 new agents to onboard and the manual UI is painful.

Here’s the rough loop I’m running:

for row in csv_reader:
 user = models.CreateUserRequest(
 name=row['Name'],
 email=row['Email'],
 username=row['Username'],
 division_id=default_division_id
 )
 response = client.users.post_users(body=user)
 print(f"Created {row['Username']}: {response.status_code}")

It works for the first 20 or so users. Then it starts throwing 429 Too Many Requests errors. The SDK doesn’t seem to have a built-in retry mechanism that respects the Retry-After header automatically for write operations like this.

I tried adding a time.sleep(1) inside the loop, but it’s still hitting the limit. The 429 response includes a Retry-After header, but parsing that dynamically in a tight loop feels messy. Is there a cleaner pattern for batch operations with the Python SDK? Or am I missing a specific config option on the PureCloudPlatformClientV2 instance?

Just want to avoid hardcoding sleep times that might be too aggressive or too slow. Any tips?