Running a script to update queue settings for 500 queues. The token refresh logic in the Python SDK seems broken. It grabs the initial token fine, starts the loop, and then dies at queue 212 with a 401 Unauthorized. The docs say the SDK handles token refresh automatically, but it’s not happening here. The script just crashes without retrying.
client = gen_api.platform_client.PlataformClient(...)
for q in queues:
body = gen_api.models.QueuePostSettings(...)
try:
client._api.post_routing_queues_queue_id_settings(q.id, body=body)
except Exception as e:
print(f"Failed on {q.id}: {e}")
break
The error log shows HTTPError: 401 Client Error: Unauthorized for url: ...//queues/{id}/settings. I’ve checked the token expiry in the response, it’s definitely past the lifetime. Why isn’t the SDK refreshing it before the next call?