Add custom request timeout support for VWS and CloudRecoService#2823
Merged
adamtheturtle merged 19 commits intomainfrom Feb 15, 2026
Merged
Add custom request timeout support for VWS and CloudRecoService#2823adamtheturtle merged 19 commits intomainfrom
adamtheturtle merged 19 commits intomainfrom
Conversation
Allow users to configure request timeouts instead of using a hardcoded 30-second default. Both VWS and CloudRecoService now accept an optional request_timeout_seconds parameter during initialization, with proper defaults and documentation. Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
Add test_timeout_raises_on_slow_response and test_longer_timeout_succeeds tests to both VWS and CloudRecoService. These tests simulate slow server responses and verify that short timeouts actually raise Timeout exceptions. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Use keyword arguments for patch.object and pytest.raises to satisfy mypy's type checking. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The timeout parameter now accepts either a float (applied to both connect and read timeouts) or a (connect, read) tuple, matching the requests library's timeout interface. Updated docstrings to reference requests. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
_target_api_request used plain @beartype which rejects int for float, while VWS.__init__ used is_pep484_tower=True which accepts it. This caused integer timeouts to pass construction but fail on first request. Enable is_pep484_tower on _target_api_request and CloudRecoService too. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Remove branching and time.sleep from slow_request mocks, fixing coverage gaps (partial branches) and Windows CI timeouts - Remove test_longer_timeout_succeeds (redundant with test_custom_timeout) - Assert the timeout value is passed correctly instead of branching - Remove unused time import and unused *args parameter Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Upgrade vws-python-mock to 2026.2.15 which adds response_delay_seconds parameter. Replace unittest.mock.patch-based timeout simulation with MockVWS(response_delay_seconds=0.5), testing the real timeout mechanism end-to-end. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2 tasks
…timeouts # Conflicts: # tests/test_query.py # tests/test_vws.py
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
Adds support for configurable request timeouts in both VWS and CloudRecoService APIs. Previously, timeouts were hardcoded to 30 seconds. Now users can specify a custom timeout during client initialization.
Changes
request_timeout_secondsparameter to VWS and CloudRecoService constructors with 30-second defaultTesting
Tests verify that the default timeout is 30 seconds and that custom timeouts can be set and used successfully.
Note
Low Risk
Small, backwards-compatible change that only affects HTTP request timeout configuration and adds targeted tests; main risk is behavioral change if callers relied on the fixed 30s timeout.
Overview
Adds an optional
request_timeout_secondsparameter toVWSandCloudRecoServiceconstructors (defaulting to 30s) and threads it through to the underlyingrequests.requestcalls, replacing the previously hardcoded timeout.Expands test coverage in
test_vws.pyandtest_query.pyto verify both default timeout behavior and custom timeout values (including(connect, read)tuples), and documents the change inCHANGELOG.rst.Written by Cursor Bugbot for commit a69677c. This will update automatically on new commits. Configure here.