Skip to content

Commit 41593c9

Browse files
authored
Merge pull request #15 from planet-a-ventures/fix-50x
feat: add retry strategy for HTTP requests in REST client
2 parents 3481ab7 + 3ecc462 commit 41593c9

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

dlt_source_personio/rest_client.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import logging
33

44
import dlt
5+
from dlt.sources.helpers.requests.retry import Client
56
from dlt.sources.helpers.rest_client.client import RESTClient, Response
67
from dlt.sources.helpers.rest_client.paginators import JSONLinkPaginator
78

@@ -12,7 +13,11 @@
1213
from dlt.sources.helpers.requests.session import Session
1314

1415
# Share a session (and thus pool) between all rest clients
15-
session: Session = Session(raise_for_status=False)
16+
# Client by default retries on all 5xx errors (including 502, 504) and 429
17+
# with exponential backoff, up to 5 attempts
18+
session: Session = Client(
19+
raise_for_status=False,
20+
).session
1621

1722
auth: PersonioOAuth2ClientCredentials = None
1823

0 commit comments

Comments
 (0)