1---2name: contentstack-utils3description: Use for Stack initialization, queries, entries, assets, live preview, taxonomy, and variants in contentstack-python.4---56# Contentstack CDA SDK – Contentstack Python CDA SDK78## When to use910- Implementing or changing `Stack`, content-type, query, entry, or asset behavior.11- Working with live preview, taxonomy, global fields, variants, or image transforms.12- Assessing CDA API alignment or extending the public SDK surface.1314## Instructions1516### Stack entry1718- **`Stack`** in `contentstack/stack.py`: validates `api_key`, `delivery_token`, `environment`; resolves `region → host` via `ContentstackRegion`; builds `endpoint`; wires `HTTPSConnection` with `headers`, `timeout`, `urllib3.Retry`, and optional `live_preview` / `branch` / `early_access`.1920### Features2122- **Content types & entries** — `contenttype.py`, `entry.py`, `entryqueryable.py`.23- **Queries** — `basequery.py`, `query.py`; chain methods align with CDA query parameters.24- **Assets** — `asset.py`, `assetquery.py`.25- **Taxonomy, global fields, variants, image transform** — `taxonomy.py`, `globalfields.py`, `variants.py`, `image_transform.py`.26- **Sync** — `Stack.sync_init`, `pagination`, `sync_token` → `/stacks/sync` via `__sync_request`.2728### Live preview2930- `live_preview` dict (`enable`, `host`, `authorization`, etc.) merged in `deep_merge_lp.py` / stack setup; keep behavior aligned with `tests/test_live_preview.py`.3132### HTTP layer3334- `https_connection.py` — `requests.Session`, `HTTPAdapter`, `get_request` from `controller.py`; user-agent uses `contentstack.__title__` / `__version__`.3536### Extending3738- Add query or stack methods consistent with [CDA query parameters](https://www.contentstack.com/docs/developers/apis/content-delivery-api/).39- Keep transport logic in `HTTPSConnection` / `controller` rather than duplicating `requests` setup.4041### Dependencies4243- `requests`, `urllib3` (`Retry`), `python-dateutil`