You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 672c58b
Browse filesBrowse the repository at this point in the historyBrowse files
refactor!: mark secondary arguments as keyword-only (#2318)
Secondary arguments across the public API are now keyword-only, the same
way as in apify/apify-client-python#766. The main argument of each call
(key, value, data, selector, path) stays positional. Named call sites
read better, and new options can go anywhere in a signature without
breaking existing callers.
The full list is in the v2 upgrade guide. It covers the context helpers
(`push_data`, `add_requests`, `block_requests`),
`BasicCrawler.get_data`/`export_data`, `KeyValueStore.set_value` and the
key iterators, `Dataset.export_to`, `ConcurrencySettings`,
`RequestList`, `ProxyConfiguration.new_url`/`new_proxy_info`, the
adaptive crawler factories and selector helpers,
`HeaderGenerator.get_specific_headers`, `BrowserController.new_page`,
`PlaywrightPersistentBrowser` and `find_links` on the parsers.
`KeyValueStore.get_value` keeps `default_value` positional to match
Crawlee JS. The three arguments of `new_proxy_info` now default to
`None`, as on `new_url`.
Closes: #1863
*✍️ Drafted by Claude Code*
Copy file name to clipboardExpand all lines: docs/upgrading/upgrading_to_v2.md
+34Lines changed: 34 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -20,3 +20,37 @@ We drop support for Python 3.10, which reached its end of life in October 2026.
20
20
## `RequestQueueClient.is_finished` is abstract
21
21
22
22
`RequestQueueClient.is_finished` is now an abstract method. In v1, it fell back to `is_empty`, which ignores requests still being processed and could report the queue as finished too early. A subclass that doesn't implement it raises `TypeError` on instantiation. If you have a custom request queue client, implement `is_finished` so that it returns `True` only when the queue is empty and no requests are in progress. The built-in clients already implement it.
23
+
24
+
## Keyword-only arguments
25
+
26
+
Secondary arguments of the public API are now keyword-only. The main argument of each call, such as a key, a value, a selector or a path, stays positional. A call that passes any of the following arguments positionally raises `TypeError`, so pass them by name:
27
+
28
+
-`context.push_data(data, *, dataset_id, dataset_name, dataset_alias)`, and the same for `RequestHandlerRunResult.push_data`.
29
+
-`context.add_requests(requests, *, rq_id, rq_name, rq_alias)`, and the same for `RequestHandlerRunResult.add_requests`.
30
+
-`context.block_requests(*, url_patterns, extra_url_patterns)`, and `block_requests(page, *, url_patterns, extra_url_patterns)`.
-`ProxyConfiguration.new_url(*, session_id, request, proxy_tier)` and `ProxyConfiguration.new_proxy_info(*, session_id, request, proxy_tier)`. All three arguments of `new_proxy_info` now default to `None`.
39
+
-`AdaptivePlaywrightCrawler.with_beautifulsoup_static_parser(*, ...)` and `with_parsel_static_parser(*, ...)`.
40
+
-`AdaptivePlaywrightCrawlingContext.wait_for_selector`, `query_selector_one`, `query_selector_all` and `parse_with_static_parser`, which take `timeout` by keyword only.
-`AbstractHttpParser.find_links(parsed_content, selector, *, attribute)`, including the built-in parsers. Custom parsers keep working, since the crawler passes `attribute` by keyword.
0 commit comments