Stuck on auth token management with the Python SDK. The docs imply the client handles refresh automatically, but my background worker dies after an hour.
Here’s the setup:
client = ApiEnvironment(client_id=CLIENT_ID, client_secret=CLIENT_SECRET)
client.login()
while True:
try:
response = client.get_queue_list()
cess_data(response)
time.sleep(60)
except Exception as e:
print(f"Error: {e}")
break
The script runs fine for the first hour. Then I hit 401 Unauthorized. The SDK doesn’t seem to trigger a refresh in the background thread. I’ve tried calling client.refresh_token() manually in the except block, but that feels like a hack.
Is there a specific config flag I’m missing? Or do I need to implement my own token cache with a refresh timer? The hybrid setup makes manual refresh painful since we have multiple workers.
Tried setting auto_refresh=True (doesn’t exist) and checking the OAuth module source. Nothing obvious. Frustrating.