Requests wrapper
dlt provides a customized Python Requests client with automatic retries and configurable timeouts.
We recommend using this to make API calls in your sources as it makes your pipeline more resilient to intermittent network errors and other random glitches which otherwise can cause the whole pipeline to fail.
The dlt requests client will additionally set the default user-agent header to dlt/{DLT_VERSION_NAME}.
For most use cases, this is a drop-in replacement for requests, so in places where you would normally do:
import requests
You can instead do:
from dlt.sources.helpers import requests
And use it just like you would use requests:
response = requests.get(
'https://example.com/api/contacts',
headers={'Authorization': API_KEY}
)
data = response.json()
...