René's URL Explorer Experiment


Title: Optionally raise instead of swallowing JSON decode errors by jakobovski-arb · Pull Request #1027 · massive-com/client-python · GitHub

Open Graph Title: Optionally raise instead of swallowing JSON decode errors by jakobovski-arb · Pull Request #1027 · massive-com/client-python

X Title: Optionally raise instead of swallowing JSON decode errors by jakobovski-arb · Pull Request #1027 · massive-com/client-python

Description: The problem _get and _paginate_iter both decode responses like this: try: obj = self._decode(resp) except ValueError as e: logger.error("Error decoding json response: %s", e) return [] A truncated or malformed body therefore becomes an empty result, which a caller cannot distinguish from "the API had nothing to return". The only trace is a log line, and the call itself succeeds. In _paginate_iter this is worse than an empty result: the bare return ends the generator early, so a partial page silently truncates a result set that still looks complete to the caller. This is not hypothetical. In a single multi-hour backfill over /v3/trades, we logged 12 of these: RESTClient ERROR: Error decoding json response: Unterminated string starting at: line 1 column 570332 (char 570331) RESTClient ERROR: Error decoding json response: Expecting ',' delimiter: line 1 column 190527 (char 190526) ... Each one produced an empty page that our pipeline recorded as a real absence — "this ticker had no auction print that day" — and cached permanently, because an empty response from a working API is a legitimate answer in our domain. We only found out by reading the log afterwards. For data ordered newest-first, where the row of interest sits on the last page, a truncated early page can drop exactly the record you were querying for. The change RESTClient(raise_on_decode_error=True) raises a new ResponseDecodeError from both decode sites instead of returning []. The flag threads to VXClient; other BaseClient subclasses inherit it through RESTClient's super().__init__(). Default is False, so existing behaviour is unchanged and this is not a breaking change. Caveats, in the interest of full disclosure We think raising should eventually be the default. Converting an undecodable body into a successful empty result is a correctness hazard for any consumer that treats "empty" as data, and there is currently no way to detect it programmatically at all. We made it opt-in only to keep the change non-breaking — if you'd prefer it default-on for a major version, or gated by an env var / module-level default instead of a constructor kwarg, we're happy to rework it. The _paginate_iter half is the more important one, and it is arguably a bug rather than a design choice: silently returning a truncated result set is different in kind from returning an empty one, and no flag setting makes a partially-consumed generator obvious to the caller. If you'd rather fix only that site, or always raise there while keeping _get lenient, that would still address the dangerous case. A retry would be the natural follow-up. A truncated body is usually transient, so the SDK could reasonably retry a failed decode the way urllib3 retries a failed connection, rather than pushing that on every caller. We didn't include it here to keep this diff to one concern. Naming is yours to pick. raise_on_decode_error / ResponseDecodeError seemed closest to the existing BadResponse, but rename freely. Test note: test_rest/models/test_requests.py::RequestTest::test_clint_headers_concat already fails on a clean master checkout in our environment (verified by stashing this change), so it is unrelated to this PR. The other 47 tests pass, including the 4 added here. Tests test_rest/test_decode_errors.py covers: the default still returns an empty result, the opt-in raises ResponseDecodeError, the flag reaches client.vx, and a well-formed body is unaffected either way. Context: we're the authors of #1026 (maxsize on the connection pool). Both issues surfaced from the same workload — a high-concurrency historical backfill of /v3/trades — where silent data loss is expensive and hard to detect after the fact. 🤖 Generated with Claude Code

Open Graph Description: The problem _get and _paginate_iter both decode responses like this: try: obj = self._decode(resp) except ValueError as e: logger.error("Error decoding json response: %s", e) ...

X Description: The problem _get and _paginate_iter both decode responses like this: try: obj = self._decode(resp) except ValueError as e: logger.error("Error decoding json response: %s",...

Opengraph URL: https://github.com/massive-com/client-python/pull/1027

X: @github

direct link

Domain: github.com

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/:user_id/:repository/pull/:id/files(.:format)
route-controllerpull_requests
route-actionfiles
fetch-noncev2:ec71c2f9-f5b6-d527-4ee3-6d710f649a4e
current-catalog-service-hashae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b
request-id9B0A:A7C31:BD8E32:F8BA70:6AFE8AA3
html-safe-noncef913d60657e7bc64109e4f1a989a157a30a7df8fac3e4d03b0a17d5eb94370f0
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5QjBBOkE3QzMxOkJEOEUzMjpGOEJBNzA6NkFGRThBQTMiLCJ2aXNpdG9yX2lkIjoiNjk1MDIwMTEwMzM1NDg1ODE0NyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac87bac3d9903e05acd4b0890002fd1800995f4d29e3bcc45c758f11dd6c68447e
hovercard-subject-tagpull_request:4203698600
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/massive-com/client-python/pull/1027/files
twitter:imagehttps://avatars.githubusercontent.com/u/201493996?s=400&v=4
twitter:cardsummary_large_image
og:imagehttps://avatars.githubusercontent.com/u/201493996?s=400&v=4
og:image:altThe problem _get and _paginate_iter both decode responses like this: try: obj = self._decode(resp) except ValueError as e: logger.error("Error decoding json response: %s", e) ...
og:site_nameGitHub
og:typeobject
hostnamegithub.com
expected-hostnamegithub.com
Noneb3c0f155eafc27e60db6e254d1ffff0e072e9ab3b4018a5ee518797c19d89f86
turbo-cache-controlno-preview
diff-viewunified
go-importgithub.com/massive-com/client-python git https://github.com/massive-com/client-python.git
octolytics-dimension-user_id191946194
octolytics-dimension-user_loginmassive-com
octolytics-dimension-repository_id216660192
octolytics-dimension-repository_nwomassive-com/client-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id216660192
octolytics-dimension-repository_network_root_nwomassive-com/client-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
release4a10310af51a1bfffbedc4fd81cb582acf0cb0ff
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/massive-com/client-python/pull/1027/files#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmassive-com%2Fclient-python%2Fpull%2F1027%2Ffiles
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
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
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://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
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmassive-com%2Fclient-python%2Fpull%2F1027%2Ffiles
Sign uphttps://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=massive-com%2Fclient-python
Reloadhttps://github.com/massive-com/client-python/pull/1027/files
Reloadhttps://github.com/massive-com/client-python/pull/1027/files
Reloadhttps://github.com/massive-com/client-python/pull/1027/files
massive-comhttps://github.com/massive-com
client-pythonhttps://github.com/massive-com/client-python
Codehttps://github.com/massive-com/client-python
Issues13 (13)https://github.com/massive-com/client-python/issues
Pull requests6 (6)https://github.com/massive-com/client-python/pulls
Actionshttps://github.com/massive-com/client-python/actions
Security and qualityhttps://github.com/massive-com/client-python/security
Insightshttps://github.com/massive-com/client-python/insights
Sign up for GitHub https://github.com/signup?return_to=%2Fmassive-com%2Fclient-python%2Fissues%2Fnew%2Fchoose
terms of servicehttps://docs.github.com/terms
privacy statementhttps://docs.github.com/privacy
Sign inhttps://github.com/login?return_to=%2Fmassive-com%2Fclient-python%2Fissues%2Fnew%2Fchoose
jakobovski-arbhttps://github.com/jakobovski-arb
massive-com:masterhttps://github.com/massive-com/client-python/tree/master
jakobovski-arb:raise-on-undecodable-responsehttps://github.com/jakobovski-arb/client-python/tree/raise-on-undecodable-response
Conversation 0 https://github.com/massive-com/client-python/pull/1027
Commits 1 https://github.com/massive-com/client-python/pull/1027/commits
Checks 0 https://github.com/massive-com/client-python/pull/1027/checks
Files changed https://github.com/massive-com/client-python/pull/1027/files
Please reload this pagehttps://github.com/massive-com/client-python/pull/1027/files
Optionally raise instead of swallowing JSON decode errors https://github.com/massive-com/client-python/pull/1027/files#top
Show all changes 1 commit https://github.com/massive-com/client-python/pull/1027/files
dc2f6d9 fix(rest): optionally raise instead of swallowing JSON decode errors Jakobovski Aug 4, 2026 https://github.com/massive-com/client-python/pull/1027/commits/dc2f6d9ae843cad354311eb055b959cccfd8690c
Clear filters https://github.com/massive-com/client-python/pull/1027/files
Please reload this pagehttps://github.com/massive-com/client-python/pull/1027/files
Please reload this pagehttps://github.com/massive-com/client-python/pull/1027/files
exceptions.py https://github.com/massive-com/client-python/pull/1027/files#diff-a4ff8da954cea5bf7f2912cec96d982b287587d16f51c35285f0ee4c2198f46d
__init__.py https://github.com/massive-com/client-python/pull/1027/files#diff-2c0dc76c88981b7edbeda7f5af3ae027a11f0e70b0817a72601600e5988e4052
base.py https://github.com/massive-com/client-python/pull/1027/files#diff-e5c5d7ec047c77338f0e90ae51c7318a19e990de673ba0c1f403d7f3cb0d6376
test_decode_errors.py https://github.com/massive-com/client-python/pull/1027/files#diff-a0d4bdfeac4671edd96f9431fae996b0326367c1ccab675534f210d0c6e20896
https://github.com/massive-com/client-python/blob/master/.github/CODEOWNERS#L1
massive/exceptions.pyhttps://github.com/massive-com/client-python/pull/1027/files#diff-a4ff8da954cea5bf7f2912cec96d982b287587d16f51c35285f0ee4c2198f46d
View file https://github.com/massive-com/client-python/blob/dc2f6d9ae843cad354311eb055b959cccfd8690c/massive/exceptions.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/massive-com/client-python/pull/1027/{{ revealButtonHref }}
https://github.com/massive-com/client-python/pull/1027/files#diff-a4ff8da954cea5bf7f2912cec96d982b287587d16f51c35285f0ee4c2198f46d
https://github.com/massive-com/client-python/blob/master/.github/CODEOWNERS#L1
massive/rest/__init__.pyhttps://github.com/massive-com/client-python/pull/1027/files#diff-2c0dc76c88981b7edbeda7f5af3ae027a11f0e70b0817a72601600e5988e4052
View file https://github.com/massive-com/client-python/blob/dc2f6d9ae843cad354311eb055b959cccfd8690c/massive/rest/__init__.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/massive-com/client-python/pull/1027/{{ revealButtonHref }}
https://github.com/massive-com/client-python/pull/1027/files#diff-2c0dc76c88981b7edbeda7f5af3ae027a11f0e70b0817a72601600e5988e4052
https://github.com/massive-com/client-python/pull/1027/files#diff-2c0dc76c88981b7edbeda7f5af3ae027a11f0e70b0817a72601600e5988e4052
https://github.com/massive-com/client-python/pull/1027/files#diff-2c0dc76c88981b7edbeda7f5af3ae027a11f0e70b0817a72601600e5988e4052
https://github.com/massive-com/client-python/blob/master/.github/CODEOWNERS#L1
massive/rest/base.pyhttps://github.com/massive-com/client-python/pull/1027/files#diff-e5c5d7ec047c77338f0e90ae51c7318a19e990de673ba0c1f403d7f3cb0d6376
View file https://github.com/massive-com/client-python/blob/dc2f6d9ae843cad354311eb055b959cccfd8690c/massive/rest/base.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/massive-com/client-python/pull/1027/{{ revealButtonHref }}
https://github.com/massive-com/client-python/pull/1027/files#diff-e5c5d7ec047c77338f0e90ae51c7318a19e990de673ba0c1f403d7f3cb0d6376
https://github.com/massive-com/client-python/pull/1027/files#diff-e5c5d7ec047c77338f0e90ae51c7318a19e990de673ba0c1f403d7f3cb0d6376
https://github.com/massive-com/client-python/pull/1027/files#diff-e5c5d7ec047c77338f0e90ae51c7318a19e990de673ba0c1f403d7f3cb0d6376
https://github.com/massive-com/client-python/pull/1027/files#diff-e5c5d7ec047c77338f0e90ae51c7318a19e990de673ba0c1f403d7f3cb0d6376
https://github.com/massive-com/client-python/pull/1027/files#diff-e5c5d7ec047c77338f0e90ae51c7318a19e990de673ba0c1f403d7f3cb0d6376
https://github.com/massive-com/client-python/pull/1027/files#diff-e5c5d7ec047c77338f0e90ae51c7318a19e990de673ba0c1f403d7f3cb0d6376
https://github.com/massive-com/client-python/pull/1027/files#diff-e5c5d7ec047c77338f0e90ae51c7318a19e990de673ba0c1f403d7f3cb0d6376
https://github.com/massive-com/client-python/pull/1027/files#diff-e5c5d7ec047c77338f0e90ae51c7318a19e990de673ba0c1f403d7f3cb0d6376
https://github.com/massive-com/client-python/blob/master/.github/CODEOWNERS#L1
test_rest/test_decode_errors.pyhttps://github.com/massive-com/client-python/pull/1027/files#diff-a0d4bdfeac4671edd96f9431fae996b0326367c1ccab675534f210d0c6e20896
View file https://github.com/massive-com/client-python/blob/dc2f6d9ae843cad354311eb055b959cccfd8690c/test_rest/test_decode_errors.py
Open in desktop https://desktop.github.com
https://github.co/hiddenchars
https://github.com/massive-com/client-python/pull/1027/{{ revealButtonHref }}
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.