Cognigy REST API pagination loop stalls on rate limit despite retry logic

Problem

The script’s pulling Cognigy transcripts for sentiment scoring but the rate limiter keeps blocking the flow before Redshift gets anything.

Code

def pull_logs(token, cursor=None):
 resp = requests.get("https://api.cognigy.com/v1/data/logs", headers={"Authorization": f"Bearer {token}"}, params={"limit": 100, "cursor": cursor})
 if resp.status_code == 429:
 time.sleep(int(resp.headers.get("Retry-After", 3)))
 return pull_logs(token, cursor)
 return resp.json()

Error

Hitting 429 Too Many Requests non-stop while the Retry-After header vanishes after the first retry, which breaks the sleep call and resets the cursor anyway.

Question

Should I track the nextPageToken manually or is the API’s dropping it during throttling? The response body only returns hasMore: true with no actual next pointer.