Skip to content

docs(extract): explain the 429 domain_rejection_limit answer from prepare_domain() - #78

Merged
jonathan-zenrows merged 1 commit into
mainfrom
docs/prepare-domain-rejection-limit
Nov 23, 2026
Merged

jonathan-zenrows merged 1 commit into
mainfrom
docs/prepare-domain-rejection-limit

Conversation

@jonathan-zenrows

Copy link
Copy Markdown
Contributor

What changes for a caller

The API can now refuse prepare_domain() with a 429 whose problem code is domain_rejection_limit. It means this domain's preparations failed verification as many times as the monthly limit allows. Don't submit that domain again this month. You can still prepare other domains, and the refused submission cost nothing. The problem body also carries domain, rejected, limit and month.

The client already handles it. PreparedDomainError carries the code, the detail and the whole problem body, and the client sends the call once even with retries turned on. The existing 429 out_of_allowance keeps its own code. Behaviour does not change, so this is a docs change.

Changes

  • The PreparedDomainError doc comment, the prepare_domain() docstring and the prepare section of README.md list domain_rejection_limit next to out_of_allowance.
  • README.md explains how the two 429 codes differ.
  • A new test sends a 429 domain_rejection_limit body. It checks the code, the exact detail and the domain, rejected, limit and month members, and that the client sent one request with retries configured.

Tests

make test (pytest): 445 passed, 12 subtests passed. make check (ty, ruff check, ruff format --check): all green.

Live proof

The proof script runs the wheel that uv build produced, installed in an isolated environment, against a local HTTP stub through base_url. It creates the client with retries=3. The stub answers the prepare POST with the 429 problem body.

The stub answers domain_rejection_limit:

$ uv run --isolated --with dist/zenrows-1.13.0-py3-none-any.whl python py-proof.py $PORT
status_code: 429
code: domain_rejection_limit
detail: example.com had 3 rejected preparation attempts this month (failed verification); the limit is 3 per domain per month. This submission was not accepted and not counted against your allowance. New attempts for this domain reopen at the start of next month (UTC).
problem members: {"domain": "example.com", "rejected": 3, "limit": 3, "month": "2026-11"}
stub log:
STUB got POST /v1/extract/prepared-domains body={"domain": "example.com", "example_urls": ["https://example.com/p/1"]}

Negative case: the same stub answers out_of_allowance, which still comes back as its own code with its own members:

$ uv run --isolated --with dist/zenrows-1.13.0-py3-none-any.whl python py-proof.py $PORT
status_code: 429
code: out_of_allowance
detail: This account has used 10 of 10 domain preparations this month.
problem members: {"limit": 10, "month": "2026-11", "used": 10}
stub log:
STUB got POST /v1/extract/prepared-domains body={"domain": "example.com", "example_urls": ["https://example.com/p/1"]}

Each stub log shows one POST, so the client retried neither answer.

…pare_domain()

prepare_domain() can now be refused with a 429 domain_rejection_limit when
a domain's preparations failed verification as many times as the monthly
limit allows. PreparedDomainError already carries its code, detail and
members, and the client never retries it; this documents it next to
out_of_allowance and adds a test that pins that behaviour.
@jonathan-zenrows
jonathan-zenrows marked this pull request as ready for review November 23, 2026 08:39

@gonzalo-zenrows gonzalo-zenrows left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I verified that prepare_domain() raises PreparedDomainError with the server’s code, detail, and rejection fields in err.problem. The client sent one request with retries enabled.

@jonathan-zenrows
jonathan-zenrows merged commit f3cf2a1 into main Nov 23, 2026
2 checks passed
@jonathan-zenrows
jonathan-zenrows deleted the docs/prepare-domain-rejection-limit branch November 23, 2026 21:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants