Docs state: “The OAuth client credentials grant provides an access token that is valid for a limited duration.” I’m running a daily analytics export job using the Python SDK (genesys-cloud-python) to pull conversation metrics and push them to S3 via boto3. The script works fine for small date ranges, but when I run a full month of data, it crashes halfway through.
Here’s the loop structure:
import boto3
from platform.client import PlatformClient
client = PlatformClient()
s3 = boto3.client('s3')
for day in date_range:
# This call fails after ~2 hours
response = client.analytics.get_analytics_conversations_metrics(
date_from=day,
date_to=day,
view='default'
)
s3.put_object(Bucket='my-analytics-bucket', Key=f'data/{day}.json', Body=json.dumps(response.body))
The error is 401 Unauthorized on the get_analytics_conversations_metrics call. I assumed the SDK handles token refresh automatically under the hood since it’s an “expert” tier tool. Am I missing a config flag? Or do I need to manually hook into the token refresh event and re-instantiate the PlatformClient? The docs don’t explicitly mention lifecycle management for long-running batches.