Token refresh logic fails mid-batch

Stuck on token refresh logic.

client = PureCloudPlatformClientV2()
client.login(username, password)
users_api = UsersApi(client)
for uid in range(1, 5000):
 users_api.get_user(uid)

Running the batch script crashes at iteration 1200, returning 401 Unauthorized as the bearer token expires mid-execution. What exact PureCloudPlatformClientV2 attribute binds a silent refresh callback to the underlying HTTP session?