|
1 | 1 | # Changelog |
2 | 2 |
|
| 3 | +## 3.3.0 (unreleased) |
| 4 | + |
| 5 | +Response types, a pyright gate, and two small methods that complete existing |
| 6 | +workflows. Additive minor: no wire changes. The package version in |
| 7 | +`pyproject.toml` is bumped at release time. |
| 8 | + |
| 9 | +### Added |
| 10 | + |
| 11 | +- Response `TypedDict`s (stdlib, `total=False`, no Pydantic, Python 3.9-compatible), |
| 12 | + exported from `diffbot`: `DqlResponse`/`DqlEntity`, `WebSearchResponse`/ |
| 13 | + `WebSearchResult`, `EntitiesResponse`, `ExtractResponse` and per-API |
| 14 | + `ArticleExtractResponse`, `ProductExtractResponse`, ... with their object types, |
| 15 | + `CrawlJob`, `CrawlDataRecord`, `AccountResponse`, `AskChunk`. |
| 16 | +- `account(days=None)` and `verify_token()` (sync and async): `GET /v4/account`. |
| 17 | + `verify_token()` calls it with `days=1`; only an auth failure (401/403) returns |
| 18 | + `False`, every other error propagates. The account response carries `token` and |
| 19 | + `childTokens`: don't log it whole. |
| 20 | +- `crawl_download(name, *, format="json", type=None, num=None)` (sync and async): |
| 21 | + `GET /v3/crawl/data`. `format="csv"` returns `str`, otherwise a list of records. |
| 22 | + The crawl watcher now uses it. For tools that can't block, the recommended |
| 23 | + pattern is `crawl(..., watch=False)` -> `crawl_get_job` -> `crawl_download`. |
| 24 | +- `extract()` keyword-only options after `fmt`: `timeout` (server-side fetch timeout |
| 25 | + in ms, default still 30000), `mode` (overrides the `fmt="markdown"` -> `llm` |
| 26 | + mapping), `fields` (sequence, comma-joined; per-API `Literal` names), `fallback`, |
| 27 | + `discussion`, `paging`, `max_pages`, `natural_language`, `summary_num_sentences`, |
| 28 | + `max_tags`, `tag_confidence`, `category_confidence`, `use_proxy`, and `extra` |
| 29 | + for anything else (`proxy`/`proxyAuth`; keys that collide with a named option or |
| 30 | + `token`/`url` raise `ValidationError`). When you set `timeout`, the per-call |
| 31 | + transport timeout is raised to at least `timeout + 10s` (never lowered). |
| 32 | +- Dev: `pyright` (basic on `src/`, strict on `types.py`) plus `tests/typing` |
| 33 | + `assert_type` checks, run in `tests.yml`. |
| 34 | + |
| 35 | +### Fixed |
| 36 | + |
| 37 | +- `dql(format="csv")` and `dql(format="jsonl")` without `raw=True` crashed in |
| 38 | + `response.json()`. `csv` now returns `str`, `xls`/`xlsx` return `bytes`, and |
| 39 | + `jsonl` returns an iterator of entities (`AsyncIterator` from the async client). |
| 40 | + `raw=True` is unchanged (undecoded `bytes`). |
| 41 | + |
| 42 | +### Changed (type-level only) |
| 43 | + |
| 44 | +- Return annotations changed from `Dict[str, Any]` to the TypedDicts above |
| 45 | + (`dql`, `extract`, `web_search`, `entities`, `crawl_list_jobs`, `crawl_get_job`), |
| 46 | + and `dql`/`extract`/`crawl_download` gained `@overload`s. Runtime values are |
| 47 | + unchanged. A type checker may now flag keys the types don't declare; wrap the |
| 48 | + value in `typing.cast(Dict[str, Any], resp)` as the escape hatch. `dql_parallel` |
| 49 | + returns `List[Any]` (each element's type follows its own call). |
| 50 | +- `crawl_get_job` still returns `{}` for a missing job (the TypeScript SDK returns |
| 51 | + `undefined`); unchanged on purpose. |
| 52 | + |
3 | 53 | ## 3.2.0 (unreleased) |
4 | 54 |
|
5 | 55 | Shared transport foundation, a sync/async de-duplication refactor, and DQL sent |
|
0 commit comments