Conversation
…-client
Both keep this repo's retry, error handling and test fakes; the SDKs supply the
endpoints, parameter names and pagination.
crowdin-api-client never retries a 429 and retries 5xx with a fixed 100 ms
sleep, so crowdin_sdk.py swaps its requester's session for one routed through
shared.retry and turns the SDK's own loop off. Sessions are per thread there,
which the download and approve scripts now get as well as the report.
PyGithub's totalCount on a search is read off the last-page link, which GitHub
caps at 1000, so truncation comes from the item count. Search results lazily
fetch any attribute missing from the raw JSON, one GET per PR, so the test
fixtures carry every field the digest reads. The dry-run payload against the
live org is byte-identical to the requests version, at one extra request
(GET /orgs/{org}).
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.
Experiment, stacked on #59: replace the hand-rolled HTTP for GitHub and Crowdin with their SDKs while keeping this repo's retry, error handling, permissions and test fakes. SOGS, Discord and the Claude CLI are deliberately untouched.
What the SDKs do and do not give us
crowdin-api-client 1.29.0 never retries a 429 (its
should_retryis false for 300–499) and retries 5xx with a fixed 100 ms sleep.crowdin/crowdin_sdk.pyswaps the requester's session for one routed throughshared.retryand turns the SDK's own loop off, so the 5/10/6-attempt budgets,Retry-Afterhandling andFakeSessiontests are unchanged. Per-thread sessions moved into that shim, so the download and approve scripts get them as well as the report.with_fetch_all()replacespaged().PyGithub 2.10.0 —
GithubRetryis configured to the same shape asshared.retry(6 attempts, backoff to 30 s,Retry-Aftercapped at 60 s, 429 + 5xx) and adds the 403 secondary rate limit. Two quirks found while porting, both handled:PaginatedList.totalCounton a search is read off thelastpage link, which GitHub caps at 1000 (it reported 1000 for a query GitHub counts at 48,951), so truncation now comes from the item count.Also:
advanced_search=trueis no longer required — GitHub answers 200 either way — so that comment was stale.Verification
digest.py --dry-run --window-hours 720against the live org: payload byte-identical to therequestsversion (6 new PRs in both), 4 requests instead of 3 (the extra isGET /orgs/{org}), no per-PR fetches.approve_strings.pyhas no tests and is compile-checked only.Cost
+269/−229. New dependencies:
crowdin-api-client(+Deprecated,wrapt),PyGithub(+pyjwt,pynacl,cryptography,typing-extensions). The GitHub tests need a ~25-line fake of PyGithub's connection interface instead ofFakeSession, and PyGithub's retry is not unit-exercisable through it.My read: Crowdin is a clear net gain; GitHub is roughly a wash.