Repository navigation
Sync SDK with Etsy API spec (Oct 2026), raise on every 4xx/5xx - #47
Merged
Merged
Conversation
Spec sync: - Add the enable_scale_validation query param to update_listing_inventory - Deprecate delete_user_address: Etsy removed deleteUserAddress from the spec - Stop sending featured_rank on updateListing; a non-zero value warns - Stop sending is_multi_video on uploadListingVideo; the kwarg warns and points callers to delete_listing_video for replacing a video - Add audit-ignore entries for the retained deprecated kwargs and method - Refresh the OAS spec baseline Error handling: - Treat every status >= 400 as an error, not a fixed list, so 429 (the new uploadListingVideo daily limit), 405, 422, 502 and 504 raise instead of returning a success-shaped Response - Keep the raw text, or the reason phrase, for non-JSON error bodies - Return a Response for success bodies that are empty or not JSON - Read limit_per_second from X-Limit-Per-Second, and tolerate missing rate-limit headers instead of raising KeyError - Token refresh drops Authorization for the refresh call only, so a failed refresh never leaves the session unauthenticated; new tokens are stored only after access_token, refresh_token and a positive integer expires_in validate (the error names any bad field), and a non-JSON refresh body raises RequestException - Compute the refreshed expiry as a UTC-aware datetime (was utcnow()) - Update the README client example to a UTC-aware expiry Callers that branched on a Response for 402/405/410/422/429/502/504 now get a RequestException. sync_refresh now receives a UTC-aware expiry. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Test Coverage ReportOverall: 100% (1767/1767 statements covered) Coverage by file
Updated by PR Tests |
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 syncs the SDK with the current Etsy OAS spec and fixes how
EtsyClienthandles error responses and token refresh. Coverage stays at 100% (104/104 operations). Etsy has published no new GitHub releases since 2026-03-24, so the spec diff is the only source of API changes.Found 3 Must Fix, 1 Should Fix, 4 Informational. Code review added the error-handling fixes below.
Must Fix
deleteUserAddresswas removed from the spec.delete_user_addressstill sends the request, but it now emits aDeprecationWarning.featured_rankwas removed from theupdateListingbody.UpdateListingRequestkeeps the kwarg and the attribute but no longer sends the value. A non-zero value warns.0stays quiet, because fetched listings report it by default.is_multi_videowas removed fromuploadListingVideo. The kwarg stays, but any value warns and is not sent. The docstring tells callers to remove an old video withdelete_listing_videobefore they upload a replacement.Each kept kwarg and the kept method has a value-scoped entry in
specs/audit-ignore.json.Should Fix
update_listing_inventoryaccepts the new optionalenable_scale_validationquery parameter. The defaultNonesends nothing.Error handling and token refresh (
Session.py)RequestException. Before, only 400, 401, 403, 404, 409, 500, and 503 raised. A 429 from the new upload limit, or a 405, 422, 502, or 504, came back as a normalResponse.Responseinstead of crashing.limit_per_secondnow comes fromX-Limit-Per-Second. Before, it held the daily limit. A missing rate-limit header no longer raisesKeyError.Authorizationfor that call only. A failed refresh leaves the header, tokens, and expiry unchanged. The client stores new tokens only afteraccess_token,refresh_token, and a positive integerexpires_inall validate. A refresh body that is not JSON raisesRequestException.utcnow(). The README example now uses the same format.Behavior changes. Code that branched on a
Responsefor 402, 405, 410, 422, 429, 502, or 504 now gets aRequestException.sync_refreshnow receives an aware datetime. The commit usesfeat:, so it releases as a minor version.Informational (no code impact)
enable_scale_validationtemporary. Scale validation will become mandatory for all requests.ShopListingresponse still returnsfeatured_rank.uploadListingVideospec now documents a limit of 10 uploads per listing per day.Test plan
pytest: 475 passed.python scripts/audit_sdk.py --spec specs/latest.json: no parameter drift, no body drift, no stale ignores, 0 code issues, 20 verified suppressions.python scripts/check_version_consistency.py: OK at 1.2.2.expires_in), andrequestsstripping a header set toNone.specs/baseline.jsonis updated to the audited spec.🤖 Generated with Claude Code