Skip to content

Add status_code and final_url to fetch results - #159

Merged
NikhilShahi merged 2 commits into
mainfrom
claude/fetch-status-code
Nov 19, 2026
Merged

NikhilShahi merged 2 commits into
mainfrom
claude/fetch-status-code

Conversation

@NikhilShahi

@NikhilShahi NikhilShahi commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

The API is adding two fields to fetch results: the HTTP status of the page that was read and the URL it ended on after redirects. This exposes them on the SDK models so callers can tell an error or block page from real content.

Changes

  • FetchResponseData (single fetch) and PageData (batch fetch and web crawl pages) gain optional status_code (alias statusCode) and final_url (alias finalUrl).
  • New tests/test_web_fetch_status.py covering fetch, batch fetch and web crawl responses, with and without the fields.
  • Bump version to 1.15.6.

Both fields default to None: the API omits them when the browser received no response. Released versions of the SDK already ignore the extra fields, so nothing breaks for callers who have not upgraded.

Validation

  • ruff check . passes.
  • ruff format --check passes on the changed files.
  • pytest tests --ignore=tests/sandbox/e2e: 1078 passed, 4 skipped (Python 3.12).

Should be released once the API change that returns these fields is live.

🤖 Generated with Claude Code


Note

Low Risk
Additive optional Pydantic fields on response models only; backward compatible with omitted or extra API keys.

Overview
Extends the Python SDK so fetch, batch fetch, and web crawl results can carry the HTTP status and post-redirect URL the API now returns.

Optional status_code (statusCode) and final_url (finalUrl) were added to FetchResponseData (single fetch) and PageData (per-page batch/crawl output). Both default to None when the API omits them (no browser response or older cached payloads). Serialization uses the existing alias pattern.

Adds tests/test_web_fetch_status.py for parsing, aliased dumps, and omitted fields. Version bumped to 1.15.6.

Reviewed by Cursor Bugbot for commit 62e934b. Bugbot is set up for automated code reviews on this repo. Configure here.

The API now returns the HTTP status of the fetched page and the URL it
ended on after redirects, for fetch, batch fetch and web crawl. Expose
both as optional fields on FetchResponseData and PageData so callers can
tell an error or block page from real content.

Bump version to 1.15.6.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@AHarmlessPyro

AHarmlessPyro commented Nov 19, 2026 •

Copy link
Copy Markdown
Contributor

✅ Snyk checks have passed. No issues have been found so far.

Status Scan Engine Critical High Medium Low Total (0)
✅ Code Security 0 0 0 0 0 issues

💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@NikhilShahi
NikhilShahi added this pull request to the merge queue Nov 19, 2026
Merged via the queue into main with commit c8ce024 Nov 19, 2026
13 checks passed
@NikhilShahi
NikhilShahi deleted the claude/fetch-status-code branch November 19, 2026 22:39
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