Open
Conversation
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.
Links:
Jira
Actions:
Core SDK & Client:
__all__declaration inmailgun.clientto cleanly isolate the public API namespace.__repr__method to theClientclass to improve developer experience (DX) during console debugging.__dir__inClientandAsyncClientto expose dynamic endpoint routes directly to IDE autocompletion engines (VS Code, PyCharm).Configthat logs a warning if a cleartexthttp://API URL is configured.ClientandAsyncClientto help users debug API requests, generated URLs, and server errors (404,400,429).build_path_from_keysutility inmailgun.handlers.utilsto centralize and dry up URL path generation across handlers.Configrouting engine to use a deterministic, data-driven approach (EXACT_ROUTESandPREFIX_ROUTES).v1,v2,v3,v4, andv5without hardcoded logic.handle_defaultto automatically inject inline URL parameters (e.g.,/v2/x509/{domain}/status).DOMAIN_ENDPOINTS(e.g., ensuringtrackingresolves tov3instead ofv1) and corrected thecredentialsroute prefix.MappingProxyTypeto prevent accidental mutations of the client state.files(Any | None) andtimeout(int | float | tuple) to fully supportrequests/httpxcapabilities without triggering false positives in strict IDEs.api_callexception blocks to use theelseclause for successful returns, adhering to strict Ruff (TRY300) standards.create()where custom headers passed by the user were ignored instead of being merged.kwargscollision bug inupdate()by using.pop("headers")instead of.get()to prevent passing duplicate keyword arguments.TimeoutErrorandApiErrorusingfrom e.try/except TypeErrorstatus code check with robustgetattrandisinstancevalidation to prevent masking unrelated exceptions.Integration Tests:
429 Too Many Requestsand state-sharing collisions.test_routing_meta_live.py) to strictly verify SDK endpoint aliases and URL construction against live Mailgun Nginx servers.smoke_test.pyto prove cross-version dynamic routing (e.g., seamlessly switching tov4for address validation).Unit Tests:
ruffsetup in.pre-commit-config.yaml.Documentation & Repository Management:
pipdependency caching in GitHub Actions to drastically speed up CI workflows.README.md.README.mdwith new documentation and code examples for the Validations & Optimize APIs.CHANGELOG.mdto reflect the dynamic routing expansion and path interpolation.Verification & Testing:
To verify these changes locally, ensure your environment variables (
APIKEYandDOMAIN, and others) are set, then run the following commands:1. Run the Unit Test Suite (Fast):
Validates the core routing logic, data structures, and mock handlers.
2. Run the Live Routing Meta-Test (No state mutation):
Proves the SDK correctly constructs URLs for all ~30 supported endpoints by hitting live Mailgun servers (expects 200, 400, 401, or 403 responses; tests fail if the Python SDK crashes or generates a 404 bad route).
3. Run the Full Integration Suite (State mutation):
Executes end-to-end flows against your Sandbox domain (creates/deletes real resources).
4. Execute the Interactive Smoke Test:
Runs the executable documentation script demonstrating cross-version routing and payload serialization.