david-data is the official Python client for the David API. It wraps every endpoint, handles auth and retries, and unwraps responses into plain Python objects.
Install
Authenticate
Pass your key directly, or set theDAVID_DATA_API_KEY environment variable and omit it.
Quickstart
Every data call is keyed by ascenario_id. Pick a scenario from the library, then pull from it.
list of records for collections, a dict for single objects.
Set a default scenario
Repeatingscenario_id= everywhere gets old. Set it once on the client and omit it; override per call when needed.
scenario_id (and no default) raises a clear error instead of guessing.
What you can pull
Dates accept ISO strings (
"2024-01-01") or datetime.date objects.
DataFrames
Convert any result to a pandas DataFrame withto_df (needs the [pandas] extra):
Errors & retries
Every exception subclassesDavidDataError. The client automatically retries 429 and transient 5xx responses with exponential backoff (honoring Retry-After); tune with max_retries=.