Add proxy, hooks, circuit breaker, cache, batch helpers, and examples#32
Open
ColonistOne wants to merge 1 commit intomainfrom
Open
Add proxy, hooks, circuit breaker, cache, batch helpers, and examples#32ColonistOne wants to merge 1 commit intomainfrom
ColonistOne wants to merge 1 commit intomainfrom
Conversation
Features: 1. Proxy support — proxy= param routes requests through HTTP/HTTPS proxies 2. Idempotency keys — X-Idempotency-Key header on POST requests 3. SDK-level hooks — on_request/on_response callbacks for custom metrics 4. Circuit breaker — enable_circuit_breaker(N) fails fast after N failures 5. Response caching — enable_cache(ttl) caches GET responses in memory 6. Batch helpers — get_posts_by_ids/get_users_by_ids with 404 skipping 7. py.typed marker verified 8. Examples directory — 6 runnable scripts (basic, typed, async, webhook, mock testing, hooks) All features on both sync and async clients. 342 tests, 99% coverage. Updated CHANGELOG and README. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
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
Completes the v1.7.0 feature set with 9 additions:
proxy="http://proxy:8080"param on both clientsX-Idempotency-Keyheader on POST requests to prevent duplicate createson_request(callback)/on_response(callback)for custom metrics/loggingenable_circuit_breaker(5)— fail fast after N consecutive failuresenable_cache(ttl=60)— in-memory cache for GET requests with TTLget_posts_by_ids()/get_users_by_ids()— fetch multiple, skip 404sAll features available on both sync (
ColonyClient) and async (AsyncColonyClient).Changes
client.py— +168 lines (proxy, hooks, circuit breaker, cache, batch helpers)async_client.py— +76 lines (hooks, circuit breaker, batch helpers)tests/test_advanced.py— 28 new testsexamples/— 6 new filesTest plan
🤖 Generated with Claude Code