Repository navigation
feat(extract): remove the autoparse fallback and add domain preparation - #54
Open
jonathan-zenrows wants to merge 5 commits into
Open
jonathan-zenrows wants to merge 5 commits into
jonathan-zenrows wants to merge 5 commits into
Conversation
extract() and extract_async() no longer retry with autoparse when Extract answers 403 REQS007 (the domain isn't prepared for Extract yet) or the legacy 402 AUTH010. Both error responses are now returned to the caller as is, without a second request. The fallback stays available as an opt-in: pass fallback_to_autoparse=True to retry once with deprecated autoparse. To serve a domain that isn't prepared yet, prepare it with POST /v1/extract/prepared-domains. The README describes REQS007 and the opt-in fallback, and marks the autoparse fetch parameter as deprecated.
ZenRowsClient.prepare_domain(domain, example_urls) submits a domain for
Extract with POST /v1/extract/prepared-domains, and
prepared_domain_status(domain) reads its status with
GET /v1/extract/prepared-domains/{domain}. Both send the API key in the
X-API-Key header and return the parsed status object. Neither waits for
the preparation: callers poll the status themselves.
An error answer raises the new PreparedDomainError, which carries the
status code, the problem code (invalid_argument, not_found, in_progress,
out_of_allowance, overloaded, disabled), detail, reason, Retry-After and
the whole problem body.
The extract() docstring and the README point REQS007 at both methods.
…n calls prepare_domain() and prepared_domain_status() now raise ValueError for an empty or whitespace-only domain before sending anything. An empty domain used to request /v1/extract/prepared-domains/, which can resolve to the list endpoint and come back looking like a status. Both calls no longer go through the client's retry adapter, so a 429 out_of_allowance or 503 overloaded is returned on the first answer. GET used to be retried on 429/503 when retries > 0 while POST was not; the Go and Node SDKs skip client retries here too. Add prepare_domain_async() and prepared_domain_status_async(), run on the client's thread pool like the other _async wrappers.
jonathan-zenrows
marked this pull request as ready for review
October 16, 2026 06:25
… reason extract() and extract_async() no longer retry with autoparse on any answer. REQS007 and AUTH010 come back as is, in one request. fallback_to_autoparse stays in both signatures so existing calls keep working, but it has no effect: passing True emits a DeprecationWarning that points at prepare_domain(). The docstrings and the README describe the reason field of a 403 REQS007 problem body and its three cases: domain_not_prepared (prepare the domain, then poll its status), page_not_recognised (try a product, article or listing page) and domain_not_enabled (use css_extractor or contact support). Older responses may not carry a reason.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes for callers
extract()andextract_async()no longer retry with autoparse. A403withcode: "REQS007"and the legacy402withcode: "AUTH010"come back to the caller as is, in one request. The automatic retry hid the prepare step and charged for an autoparse call that often returned unusable data. Autoparse is deprecated.fallback_to_autoparsestays in both signatures, so existing calls keep working, but it is deprecated and has no effect. PassingTrueemits aDeprecationWarningthat points atprepare_domain().A
403 REQS007problem body can now carry areason. Check it when present; older responses may not carry it:domain_not_prepared: prepare the domain withclient.prepare_domain(), pollclient.prepared_domain_status()untilstatusis"ready", then retry.page_not_recognised: the domain is served, but this page isn't one Extract extracts (a home, search, login or category page). Try a product, article or listing page, or retry once in a few minutes. Preparing again changes nothing.domain_not_enabled: preparing doesn't help. Usecss_extractor, or contact support.New:
prepare_domain(domain, example_urls)andprepared_domain_status(domain)(plus_asyncversions) callPOST /v1/extract/prepared-domainsandGET /v1/extract/prepared-domains/{domain}and return the parsed status. Errors raisePreparedDomainError.Details
prepare_domain()/prepared_domain_status()send the key inX-API-Key, never poll, and skip the client'sretriesadapter, so a 429 or 503 comes back on the first answer. An empty or whitespace-only domain raisesValueErrorbefore any request.PreparedDomainErrorcarriesstatus_code,code,detail,reason,retry_afterand the wholeproblembody.reasoncases and mark theautoparsefetch parameter as deprecated.This ships as
featcommits (minor version) through release-please.Tests
fallback_to_autoparse=True(sync and async); passingTrueemits aDeprecationWarningattributed to the caller.reasonis readable from the response body.retries=1, every documented error answer.make check(ty, ruff check, ruff format --check),make test(256 passed) and the generated-models check pass locally. A production smoke test returned403 REQS007in one request with defaults and withfallback_to_autoparse=True, plus the warning.