René's URL Explorer Experiment


Title: Add transient-error classification to APIFailure by mtorp · Pull Request #93 · SocketDev/socket-sdk-python · GitHub

Open Graph Title: Add transient-error classification to APIFailure by mtorp · Pull Request #93 · SocketDev/socket-sdk-python

X Title: Add transient-error classification to APIFailure by mtorp · Pull Request #93 · SocketDev/socket-sdk-python

Description: Problem Consumers that want to retry transient API failures have no reliable way to classify an exception. The catch-all APIFailure only embeds the HTTP status in its message text (original_status_code:), so callers must parse message strings and special-case the exception hierarchy — which breaks silently if a status code gains a dedicated subclass later. SocketDev/socket-python-cli#232 (full-scan upload retry) ran into exactly this, see review discussion. Change API.do_request now records the HTTP status code on every exception it raises, via a new keyword-only status_code attribute on APIFailure (default None, so all existing construction/raise sites remain valid). APIFailure.is_transient_error() returns whether retrying the same request may succeed: True for HTTP 408/502/503/504 (gateway/availability failures) and for APITimeout / APIConnectionError (no HTTP status — the request never completed). False for deterministic errors: 400/401/403/404/429, and bare APIFailure() wrappers around unexpected errors. Classification is based on the recorded status code, not exception class identity or message text. If a transient status (e.g. 503) ever gains a dedicated subclass, is_transient_error() keeps working unchanged. Error message formats are unchanged, so existing message-parsing consumers are unaffected. Testing New tests/unit/test_exceptions.py (21 tests): classification truth table for direct construction, status codes attached by do_request per HTTP status (401/403/404/429/502 dedicated classes; 408/503/504 and 400/500 catch-all), timeout/connection-error mapping, and the wrapped-unexpected-error case. Full unit suite: 122 passed, 1 skipped. Version 3.2.1 → 3.3.0 (new public API).

Open Graph Description: Problem Consumers that want to retry transient API failures have no reliable way to classify an exception. The catch-all APIFailure only embeds the HTTP status in its message text (original_status_...

X Description: Problem Consumers that want to retry transient API failures have no reliable way to classify an exception. The catch-all APIFailure only embeds the HTTP status in its message text (original_status_...

Opengraph URL: https://github.com/SocketDev/socket-sdk-python/pull/93

X: @github

direct link

Domain: github.com

route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:58a2c5ee-aaa5-7af3-ee99-0fecd8f4fa22
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-idC71E:1FFDFF:28BFBB1:38B1393:6A4F5CC3
html-safe-nonce9012a72512f2f92aa1f89411e22b7e71817748f09d856b58a2751cfb859f0479
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDNzFFOjFGRkRGRjoyOEJGQkIxOjM4QjEzOTM6NkE0RjVDQzMiLCJ2aXNpdG9yX2lkIjoiODA4NTAxNTUxMTE2MTU5MzAyNyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacc5d0e308f1baee23324ddcae41b507f6a6aaf3d3bc185276acbda70c2beed410
hovercard-subject-tagpull_request:3838985014
github-keyboard-shortcutsrepository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///pull_requests/show/files
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/SocketDev/socket-sdk-python/pull/93/files
twitter:imagehttps://avatars.githubusercontent.com/u/5579277?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/5579277?s=400&v=4
og:image:altProblem Consumers that want to retry transient API failures have no reliable way to classify an exception. The catch-all APIFailure only embeds the HTTP status in its message text (original_status_...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noneb92d11c0aa4a77d54ef4af1078b6a15fb5a70a215b30c4ecf28889d5a8e656d9
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/SocketDev/socket-sdk-python git https://github.com/SocketDev/socket-sdk-python.git
octolytics-dimension-user_id69326764
octolytics-dimension-user_loginSocketDev
octolytics-dimension-repository_id715809144
octolytics-dimension-repository_nwoSocketDev/socket-sdk-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id715809144
octolytics-dimension-repository_network_root_nwoSocketDev/socket-sdk-python
turbo-body-classeslogged-out env-production page-responsive full-width
disable-turbotrue
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release4b249b445842943ed31549e027f57a8ade9881ed
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/SocketDev/socket-sdk-python/pull/93/files#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FSocketDev%2Fsocket-sdk-python%2Fpull%2F93%2Ffiles
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2FSocketDev%2Fsocket-sdk-python%2Fpull%2F93%2Ffiles
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fpull_requests%2Fshow%2Ffiles&source=header-repo&source_repo=SocketDev%2Fsocket-sdk-python
Reloadhttps://github.com/SocketDev/socket-sdk-python/pull/93/files
Reloadhttps://github.com/SocketDev/socket-sdk-python/pull/93/files
Reloadhttps://github.com/SocketDev/socket-sdk-python/pull/93/files
Please reload this pagehttps://github.com/SocketDev/socket-sdk-python/pull/93/files
SocketDev https://github.com/SocketDev
socket-sdk-pythonhttps://github.com/SocketDev/socket-sdk-python
Notifications https://github.com/login?return_to=%2FSocketDev%2Fsocket-sdk-python
Fork 3 https://github.com/login?return_to=%2FSocketDev%2Fsocket-sdk-python
Star 13 https://github.com/login?return_to=%2FSocketDev%2Fsocket-sdk-python
Code https://github.com/SocketDev/socket-sdk-python
Pull requests 3 https://github.com/SocketDev/socket-sdk-python/pulls
Actions https://github.com/SocketDev/socket-sdk-python/actions
Models https://github.com/SocketDev/socket-sdk-python/models
Security and quality 0 https://github.com/SocketDev/socket-sdk-python/security
Insights https://github.com/SocketDev/socket-sdk-python/pulse
Code https://github.com/SocketDev/socket-sdk-python
Pull requests https://github.com/SocketDev/socket-sdk-python/pulls
Actions https://github.com/SocketDev/socket-sdk-python/actions
Models https://github.com/SocketDev/socket-sdk-python/models
Security and quality https://github.com/SocketDev/socket-sdk-python/security
Insights https://github.com/SocketDev/socket-sdk-python/pulse
Sign up for GitHub https://github.com/signup?return_to=%2FSocketDev%2Fsocket-sdk-python%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2FSocketDev%2Fsocket-sdk-python%2Fissues%2Fnew%2Fchoose
Martin Torp (mtorp)https://github.com/mtorp
mainhttps://github.com/SocketDev/socket-sdk-python/tree/main
transient-error-classificationhttps://github.com/SocketDev/socket-sdk-python/tree/transient-error-classification
Conversation 3 https://github.com/SocketDev/socket-sdk-python/pull/93
Commits 2 https://github.com/SocketDev/socket-sdk-python/pull/93/commits
Checks 12 https://github.com/SocketDev/socket-sdk-python/pull/93/checks
Files changed https://github.com/SocketDev/socket-sdk-python/pull/93/files
Please reload this pagehttps://github.com/SocketDev/socket-sdk-python/pull/93/files
Add transient-error classification to APIFailure https://github.com/SocketDev/socket-sdk-python/pull/93/files#top
Show all changes 2 commits https://github.com/SocketDev/socket-sdk-python/pull/93/files
c0ac850 Add transient-error classification to APIFailure mtorp Jun 10, 2026 https://github.com/SocketDev/socket-sdk-python/pull/93/commits/c0ac850fbf6272be1ea6ac579a33075d9d603fac
30fba8a Hardcode 502 in APIBadGateway instead of accepting a status_code mtorp Jun 10, 2026 https://github.com/SocketDev/socket-sdk-python/pull/93/commits/30fba8af55678f98616378b0d1a10ec2c1e53e9d
Clear filters https://github.com/SocketDev/socket-sdk-python/pull/93/files
Please reload this pagehttps://github.com/SocketDev/socket-sdk-python/pull/93/files
Please reload this pagehttps://github.com/SocketDev/socket-sdk-python/pull/93/files
pyproject.toml https://github.com/SocketDev/socket-sdk-python/pull/93/files#diff-50c86b7ed8ac2cf95bd48334961bf0530cdc77b5a56f852c5c61b89d735fd711
api.py https://github.com/SocketDev/socket-sdk-python/pull/93/files#diff-83602148582afc0853f1c1ae622f4f929a2449118f0ffa8fe156ab4a4fe8cde4
exceptions.py https://github.com/SocketDev/socket-sdk-python/pull/93/files#diff-e66e9c9bfb4a66123811c29c24e8c8b08a5e618cb233163190c2b127d04415e6
version.py https://github.com/SocketDev/socket-sdk-python/pull/93/files#diff-efce00fd30764514d5fb0e13e91ade6c92c60ea48abc8846fec74267bf476e52
test_exceptions.py https://github.com/SocketDev/socket-sdk-python/pull/93/files#diff-e621f60722938a3fc61b7bc5e62f469d2dbc76c797f06861e1cbd32665c36ca3
uv.lock https://github.com/SocketDev/socket-sdk-python/pull/93/files#diff-84321598744d84dbee2318e634c74c9aae39a1c253f1c4bd17ebf9ef2f807b11
https://github.com/SocketDev/socket-sdk-python/blob/main/.github/CODEOWNERS#L1
pyproject.tomlhttps://github.com/SocketDev/socket-sdk-python/pull/93/files#diff-50c86b7ed8ac2cf95bd48334961bf0530cdc77b5a56f852c5c61b89d735fd711
View file https://github.com/SocketDev/socket-sdk-python/blob/30fba8af55678f98616378b0d1a10ec2c1e53e9d/pyproject.toml
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/SocketDev/socket-sdk-python/pull/93/{{ revealButtonHref }}
https://github.com/SocketDev/socket-sdk-python/pull/93/files#diff-50c86b7ed8ac2cf95bd48334961bf0530cdc77b5a56f852c5c61b89d735fd711
https://github.com/SocketDev/socket-sdk-python/pull/93/files#diff-50c86b7ed8ac2cf95bd48334961bf0530cdc77b5a56f852c5c61b89d735fd711
https://github.com/SocketDev/socket-sdk-python/blob/main/.github/CODEOWNERS#L1
socketdev/core/api.pyhttps://github.com/SocketDev/socket-sdk-python/pull/93/files#diff-83602148582afc0853f1c1ae622f4f929a2449118f0ffa8fe156ab4a4fe8cde4
View file https://github.com/SocketDev/socket-sdk-python/blob/30fba8af55678f98616378b0d1a10ec2c1e53e9d/socketdev/core/api.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/SocketDev/socket-sdk-python/pull/93/{{ revealButtonHref }}
https://github.com/SocketDev/socket-sdk-python/pull/93/files#diff-83602148582afc0853f1c1ae622f4f929a2449118f0ffa8fe156ab4a4fe8cde4
https://github.com/SocketDev/socket-sdk-python/pull/93/files#diff-83602148582afc0853f1c1ae622f4f929a2449118f0ffa8fe156ab4a4fe8cde4
https://github.com/SocketDev/socket-sdk-python/pull/93/files#diff-83602148582afc0853f1c1ae622f4f929a2449118f0ffa8fe156ab4a4fe8cde4
https://github.com/SocketDev/socket-sdk-python/pull/93/files#diff-83602148582afc0853f1c1ae622f4f929a2449118f0ffa8fe156ab4a4fe8cde4
https://github.com/SocketDev/socket-sdk-python/blob/main/.github/CODEOWNERS#L1
socketdev/exceptions.pyhttps://github.com/SocketDev/socket-sdk-python/pull/93/files#diff-e66e9c9bfb4a66123811c29c24e8c8b08a5e618cb233163190c2b127d04415e6
View file https://github.com/SocketDev/socket-sdk-python/blob/30fba8af55678f98616378b0d1a10ec2c1e53e9d/socketdev/exceptions.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/SocketDev/socket-sdk-python/pull/93/{{ revealButtonHref }}
https://github.com/SocketDev/socket-sdk-python/blob/main/.github/CODEOWNERS#L1
socketdev/version.pyhttps://github.com/SocketDev/socket-sdk-python/pull/93/files#diff-efce00fd30764514d5fb0e13e91ade6c92c60ea48abc8846fec74267bf476e52
View file https://github.com/SocketDev/socket-sdk-python/blob/30fba8af55678f98616378b0d1a10ec2c1e53e9d/socketdev/version.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/SocketDev/socket-sdk-python/pull/93/{{ revealButtonHref }}
https://github.com/SocketDev/socket-sdk-python/blob/main/.github/CODEOWNERS#L1
tests/unit/test_exceptions.pyhttps://github.com/SocketDev/socket-sdk-python/pull/93/files#diff-e621f60722938a3fc61b7bc5e62f469d2dbc76c797f06861e1cbd32665c36ca3
View file https://github.com/SocketDev/socket-sdk-python/blob/30fba8af55678f98616378b0d1a10ec2c1e53e9d/tests/unit/test_exceptions.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/SocketDev/socket-sdk-python/pull/93/{{ revealButtonHref }}
https://github.com/SocketDev/socket-sdk-python/blob/main/.github/CODEOWNERS#L1
uv.lockhttps://github.com/SocketDev/socket-sdk-python/pull/93/files#diff-84321598744d84dbee2318e634c74c9aae39a1c253f1c4bd17ebf9ef2f807b11
View file https://github.com/SocketDev/socket-sdk-python/blob/30fba8af55678f98616378b0d1a10ec2c1e53e9d/uv.lock
Open in desktop https://desktop.github.com
how customized files appear on GitHubhttps://docs.github.com/github/administering-a-repository/customizing-how-changed-files-appear-on-github
Please reload this pagehttps://github.com/SocketDev/socket-sdk-python/pull/93/files
Please reload this pagehttps://github.com/SocketDev/socket-sdk-python/pull/93/files
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.