429s on bulk user updates with Genesys Python SDK

I’m hitting a wall with a bulk update script for users. We have about 2,000 users to patch with new custom attributes. The script runs fine for the first 50 or so, then the Genesys Cloud API starts throwing 429 Too Many Requests errors.

I’ve tried adding a simple time.sleep(0.5) between requests, but that doesn’t seem to do much. The rate limit headers in the response suggest I should be waiting longer, but I’m not sure how to parse them correctly in the Python SDK.

Here’s the relevant snippet:

from genesyscloud import users_api_client
import time

user_api = users_api_client.UsersApi(config)

for user in users_to_update:
 try:
 user_api.put_user(
 user_id=user.id,
 body=user_data
 )
 time.sleep(0.5) # Tried 1.0, same result
 except Exception as e:
 print(f"Error on user {user.id}: {e}")

The error response looks like this:

{
 "code": "429",
 "message": "Rate limit exceeded. Please retry after X seconds."
}

How do I extract the retry-after value from the response headers in the SDK? Or is there a better way to handle the backoff logic without manually parsing headers? I don’t want to just guess at the sleep time.

It’s frustrating because the docs mention rate limiting but don’t show a concrete example of handling it in code. I’ve checked the Retry-After header, but I’m not seeing it in the standard response object.

Any pointers on the cleanest way to implement exponential backoff here?