Built a daily export job to pull interaction stats and dump them into S3. The flow is simple enough: auth with the Python SDK, fetch the data, then push to boto3.
The weird part is the timing. Sometimes the SDK requests complete just as the S3 upload starts, and I get a 429 from Genesys. Other times it works fine. I’m using the standard genesyscloud python package.
client = genesyscloud.rest_api_client.RestApiClient(...)
stats = client.analytics.get_analytics_interactions_summary(...)
# Upload to S3
s3_client.put_object(Bucket='my-bucket', Key='stats.json', Body=json.dumps(stats))
The SDK has a built-in retry mechanism for 429s, but it seems to conflict with the blocking nature of the S3 call if I’m not careful. Or maybe it’s just coincidence. I’m seeing intermittent failures where the script hangs. Is there a better way to handle the async nature of these calls? Should I be using a queue?