-
Notifications
You must be signed in to change notification settings - Fork 967
feat: New Python SDK with v2 support #841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
🟡 Heimdall Review Status
|
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
Awesome, thanks a lot for putting this out @CarsonRoscoe! To everyone interested in contributing, please FIRST write a comment here with what you'd like to work on in order to avoid any duplicate work. I will coordinate and update the TODO below with who is working on what. To simplify review, please open one PR per TODO item and try to keep changes strictly related to that to avoid merge conflicts. TODO:
|
Awesome, thanks a lot for putting this out @CarsonRoscoe! To everyone interested in contributing, please FIRST write a comment here with what you'd like to work on in order to avoid any duplicate work. I will coordinate and update the TODO below with who is working on what. To simplify review, please open one PR per TODO item and try to keep changes strictly related to that to avoid merge conflicts. TODO: -[ ] Add Solana mechanism I will work on Python facilitator example and Python client examples (httpx & requests) Please let me know if you are okay with it @CarsonRoscoe |
|
Hi @1bcMax, thanks a lot for for offering your help! Let's start with one python client example (httpx) and then go from there. Updated the TODO list accordingly |
|
Happy to review the code and examples for security issues, including both manual checks and static analysis. Please let me know if you’d like me to take a look! |
Thanks @phdargen I'd love to contribute server examples. TODO: |
Add link to in-progress Python v2 SDK work (coinbase/x402#841) in Python documentation files. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
* refactor: reorganize directory structure to language-first pattern Reorganize examples/ and docs/korean/ directories to match the official x402 repository structure (language/version/type). Changes: - examples/v1/ → examples/python/v1/ - examples/v2/ → examples/python/v2/ - docs/korean/v1/ → docs/korean/python/v1/ - docs/korean/v2/ → docs/korean/python/v2/ - Remove python- prefix from example doc filenames - Update all README path references - Update CLAUDE.md directory structure section 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * docs: convert external paths to official GitHub links - Replace local external/x402/ paths with GitHub repository links - Updated files: - examples/README.md, README.en.md - examples/python/v2/README.md, README.en.md - docs/korean/python/v1/README.md, README.en.md - docs/korean/python/v2/README.md, README.en.md - docs/korean/getting_started.ko.md - docs/korean/python/v1/examples/*.ko.md (4 files) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * refactor: docs language-first structure with TypeScript versioning - Move docs/korean/ to docs/ (language-agnostic root) - Add TypeScript v1/v2 versioning structure - Create TypeScript index README and v1 placeholder - Convert external paths to GitHub links in TypeScript docs - Fix Python v1 internal links (remove python- prefix) - Fix Python v1 examples relative paths for new structure - Add TypeScript documentation links to docs/README.md Directory structure: docs/ ├── python/v1/examples/ (Python v1 Legacy) ├── python/v2/ (Python v2) ├── typescript/v1/ (placeholder) ├── typescript/v2/ (TypeScript v2 examples) └── getting_started.ko.md, x402-v2-specification.ko.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: update broken links in getting_started.ko.md after restructure - Update Python example paths: ./v1/examples/python-* → ./python/v1/examples/* - Fix resources relative path: ../../resources/ → ../resources/ 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * style: add footer navigation to TypeScript v2 docs and update README structure - Add footer navigation to all TypeScript v2 example README files - Update main README directory structure diagram to reflect current layout - Fix broken links in README.md and README.en.md (docs/korean/ → docs/) - Update example links to new language-first structure 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: resolve 4-persona review issues (Phase 1-3) Critical fixes: - Fix 4 broken links in x402-v2-specification.ko.md (wrong path + filename) - Add TypeScript v2 Quick Start section to root README High priority fixes: - Create docs/python/README.md and README.en.md - Create docs/typescript/v2/fullstack/README.md and README.en.md - Fix docs/README.md relative path (../../README.md → ../README.md) - Fix korean-community broken link in getting_started.ko.md Medium priority fixes: - Fix Python v1 examples v2-spec links (4 files) - Add English footer navigation to TypeScript v2 docs (15 files) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: resolve broken links from final review - Fix LICENSE links in x402-v2-specification.ko.md and getting_started.ko.md (../../LICENSE → ../LICENSE) - Fix v2-spec links in python/v2/README.md and README.en.md (../x402-v2-specification.ko.md → ../../x402-v2-specification.ko.md) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * refactor: restructure Python v1 docs from examples/ to feature-based dirs - Move examples/*.ko.md to clients/, servers/, discovery/ directories - Rename all files to README.md for consistency - Update all internal links across 14 files to match new structure - Fix broken links in root READMEs, docs/, and external/ directories New structure: docs/python/v1/ ├── clients/requests/README.md ├── clients/httpx/README.md ├── servers/fastapi/README.md └── discovery/README.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * style: add language toggle linking to official x402 examples Add language toggle at the top of Python v1 docs with English links pointing to official coinbase/x402 repository examples instead of maintaining separate English translations. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * docs: update repository structure to reflect Python v1 reorganization Update docs/python/v1/ structure in both README files to show new feature-based directory layout (clients/, servers/, discovery/). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * refactor: reorganize external/ README with language versions - Update README.md as Korean default - Add README.en.md for English version - Remove redundant README.ko.md 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * refactor: simplify docs paths and rename getting_started - Remove 'korean' from docs path (docs/korean/ → docs/) - Rename getting_started.ko.md to getting_started.md - Update all references across 14 files 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * docs: add official code links to TypeScript examples table Add links to official coinbase/x402 repository for all TypeScript v2 examples (axios, fetch, express, hono, next, miniapp, mcp). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * refactor: rename x402-v2-specification.ko.md to .md Remove '.ko' suffix from v2 specification filename and update all references across 15 files for consistency. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix: update v1/examples/ references to new v1/ structure Update paths across 8 files to reflect the new directory structure: - docs/python/v1/examples/ → docs/python/v1/ (clients/, servers/, discovery/) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * docs: add English README.en.md for Python v1 examples - Create English versions for 4 Python v1 docs: - clients/requests/README.en.md - clients/httpx/README.en.md - servers/fastapi/README.en.md - discovery/README.en.md - Update Korean READMEs with correct language toggle links - Fix footer navigation paths (../ → ../../ for nested dirs) - Fix v2-spec relative paths 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * docs: add Python v2 SDK PR #841 reference Add link to in-progress Python v2 SDK work (coinbase/x402#841) in Python documentation files. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
|
Hi guys, I just opened a PR. It's just a specific example for the CDP facilitator on Mainnet to serve as a workaround until cdp-sdk is updated. #874 |
* fix format * fix lint * fix build * fix pytest
Sure @Cybercentry, testing the code and reviewing the code would be appreciated |
|
Hello, I opened #901 to make framework/client deps optional extras (more scalable, avoids dep conflicts) |
…902) - Add missing imports (base64, json, Response, JSONResponse, PaymentPayload, FacilitatorClient) - Fix function signature syntax error - Fix dict initialization syntax (colon to equals) - Add missing return statement after successful payment - Remove trailing whitespace
* feat: add fastapi example project configuration * feat: add fastapi example with x402 payment middleware * docs: add comprehensive README for fastapi example * feat: add flask example project configuration * feat: add flask example with x402 payment middleware * docs: add comprehensive README for flask example * feat: add test clients for fastapi and flask examples * docs: add test client usage to READMEs * chore - remove python-version and test-client.py * docs - remove test client guide from README.md * chore - remove license and classifier * feat - add description and mime type * feat - update .env-local
|
Thanks for pushing this along! |
* feat: add Python v2 client examples (httpx & requests) Add simple client examples demonstrating httpx (async) and requests (sync) usage with the x402 Python v2 SDK. - examples/python/clients/example.py - Simple example showing both httpx and requests - Uses EthAccountSigner with register_exact_evm_client helper - Minimal configuration required * refactor: split Python client examples into separate directories Address PR review feedback: - Separate httpx/ and requests/ directories - Add pyproject.toml for uv sync support - Add environment variable validation - Add payment response header extraction - Use context manager for requests session cleanup Tested on Base Sepolia testnet: - httpx: tx 0xce49f668aba01c4b0b1af2eb0d9a381f4c62295506a91f20af479e0e834ef350 - requests: tx 0xb83b6feefa5a744b7779ba5b37df33f9c7241f58119454d66102acd97a92f024 * Update examples/python/clients/httpx/main.py Co-authored-by: phdargen <pdargent@icloud.com> * Update examples/python/clients/requests/main.py Co-authored-by: phdargen <pdargent@icloud.com> --------- Co-authored-by: phdargen <pdargent@icloud.com>
* add svm mechanism * add unit tests * add integration tests * update server examples * add e2e tests * update clients * make EVM/SVM dependencies optional extras * fix legacy uv paths
Description
/python/legacy/python/x402TODO for Typescript/Go Parity:
Tests
Checklist