Add public API docstrings and error-handling clarity (step 17)#12
Merged
Conversation
- AsyncVisorClient and VisorClient: class docstrings covering context-manager usage, thread-safety note (sync), and constructor args; method docstrings on all public methods documenting one-page semantics, pagination helper refs, return types, and raised exceptions - exceptions.py: expanded AuthError (401 vs key issues), ForbiddenError (403 vs permissions), and RateLimitError (retry_after attribute semantics) docstrings - _transport.py: fallback actionable messages for empty 401/403 response bodies; API-provided messages are always preferred - tests/test_transport.py: parametrized sync and async tests for the new empty-body fallback paths Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The previous docstrings told users to call paginate_listings/iter_listings with a dealer_id parameter that does not exist on those helpers. Replaced with a correct manual-pagination note (advance filter.page in a loop). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The SDK uses ListingsFilter.offset for pagination, not .page. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
AsyncVisorClientandVisorClient, covering one-page vs. paginate semantics, return types, important params, and the full raised-exception list.VisorClientclass docstring notes the thread-safety caveat and context-manager usage.AuthError(401 = missing/invalid key),ForbiddenError(403 = valid key, no permission for resource), andRateLimitError(retry_afterattribute: seconds orNone, usage example).messagenow falls back to a short actionable default instead of an empty string. API-provided messages are always preferred (api_message or fallback).Fixes in review
paginate_listings/iter_listingswithdealer_idhint (those helpers don't accept that parameter).filter.page→filter.offsetindealer_inventorydocstrings (SDK uses offset-based pagination).Test plan
pytest --cov=visor --cov-report=term-missing— 232 passed, 99% coverageruff check src/ tests/— no issuesruff format --check src/ tests/— no issuesmypy src/— no issuespython -m build— wheel and sdist built successfullypython -m twine check dist/*— both artifacts passedvisor/py.typedpresent in wheelVisor API Docs/,Design Docs/,.coverage) absent from sdist🤖 Generated with Claude Code