Zendesk Retries (#3558)

* k

* k

* k

* k
This commit is contained in:
Yuhong Sun
2024-12-28 15:51:49 -08:00
committed by GitHub
parent 2203cfabea
commit fc81a3fb12
3 changed files with 12 additions and 3 deletions

View File

@@ -40,6 +40,13 @@ class ZendeskClient:
response = requests.get(
f"{self.base_url}/{endpoint}", auth=self.auth, params=params
)
if response.status_code == 429:
retry_after = response.headers.get("Retry-After")
if retry_after is not None:
# Sleep for the duration indicated by the Retry-After header
time.sleep(int(retry_after))
response.raise_for_status()
return response.json()