feat: Replace niquests with httpx - #604
Merged
Merged
Conversation
razor-x
marked this pull request as ready for review
August 12, 2026 23:53
razor-x
force-pushed
the
claude/http-library-options-cxtlwv
branch
from
August 13, 2026 03:30
df592ce to
cbe98fd
Compare
The niquests dependency urllib3-future installs into the urllib3 package namespace, which conflicts with packages depending on genuine urllib3 in customer environments and cannot be mitigated from the SDK. httpx is already in the dependency tree via svix and its dependency chain does not touch urllib3. BREAKING CHANGE: The niquests_options option is now httpx_options and is passed to the underlying httpx.Client. The retries option now takes a seam.Retry instead of a urllib3.util.Retry; the fields mirror the urllib3 names. Seam.client is now an httpx.Client subclass, and request errors are raised as httpx exceptions, e.g. httpx. HTTPStatusError instead of niquests.HTTPError and httpx. TimeoutException instead of niquests.exceptions.Timeout. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QxwdLpWpFhxSn7mZ2Fb6p1
The retries option now takes an httpx_retries.Retry, re-exported as seam.Retry. Its fields mirror the urllib3.util.Retry names. Unlike the previous urllib3 default, the default policy does not retry connection errors for POST requests; pass allowed_methods=["POST"] to opt in to retrying Seam API requests. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QxwdLpWpFhxSn7mZ2Fb6p1
Which HTTP methods the Seam API uses is not part of the SDK's public API, so a configured retry policy must not require consumers to name them in allowed_methods. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QxwdLpWpFhxSn7mZ2Fb6p1
Resource classes define their own from_dict on standard library dataclasses and nothing imports dataclasses_json. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QxwdLpWpFhxSn7mZ2Fb6p1
The SDK is a library, so keep dependency constraints as permissive as possible. The httpx floor matches svix, and the httpx-retries floor is the release that introduced Retry.copy_with. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QxwdLpWpFhxSn7mZ2Fb6p1
The retries option should not silently modify the policy it is given. Since httpx-retries does not treat POST as retryable, the retry policy currently has no effect on Seam API requests; the affected tests are marked xfail. A follow-up PR will apply the retry policy to API requests without exposing the HTTP method in the SDK's public API. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QxwdLpWpFhxSn7mZ2Fb6p1
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QxwdLpWpFhxSn7mZ2Fb6p1
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QxwdLpWpFhxSn7mZ2Fb6p1
razor-x
force-pushed
the
claude/http-library-options-cxtlwv
branch
from
August 13, 2026 04:10
6adc7f5 to
d08abb9
Compare
Draft
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.
Summary
This PR migrates the SDK from niquests to httpx as the HTTP client library, replacing urllib3's Retry with the httpx-retries package.
niquests depends on urllib3-future, which installs into the
urllib3package namespace and conflicts with packages depending on genuine urllib3 in customer environments (see the LaunchDarkly/gevent report and theHAS_NEVER_CHECK_COMMON_NAMEhybrid-install failures). httpx was already in the dependency tree via svix, and its dependency chain does not touch urllib3, so this class of breakage becomes structurally impossible.Key Changes
HTTP Client Migration: Replaced niquests.Session with httpx.Client throughout the codebase
base_urland client-level timeouts, so the URL-joining and timeout plumbing workarounds are goneRetries via httpx-retries: The
retriesoption now takes an httpx-retriesRetry, re-exported asseam.Retrytotal,backoff_factor,status_forcelist,respect_retry_after_header), so migration is a one-line import changehttpx_retries.RetryTransportwrapping the client transportAPI Updates:
niquests_optionsparameter tohttpx_optionsacross Seam, SeamWithoutWorkspace, and SeamHttpClientDependencies: niquests, urllib3-future, and the compiled qh3/jh2 wheels are gone from the lockfile; httpx (already required via svix) and the pure-Python httpx-retries are the only additions. Constraints are kept as permissive as possible (
httpx>=0.23.0,<1, matching svix's floor; verified the test suite passes on httpx 0.23.0). Also removed the unused dataclasses-json dependency.Documentation: Updated README with sections for configuring retries and httpx client options
Tests: Updated test suite to work with httpx exceptions and behavior
Breaking Changes
niquests_options→httpx_optionsretriestakesseam.Retry(httpx-retries) instead ofurllib3.util.RetrySeam.clientis anhttpx.Clientsubclass; request errors surface as httpx exceptionsretriespolicy is configuredhttps://claude.ai/code/session_01QxwdLpWpFhxSn7mZ2Fb6p1