-
-
Notifications
You must be signed in to change notification settings - Fork 672
x402 integration into aop #1175
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
Conversation
| Then test with your MCP client or directly via HTTP. | ||
| """ | ||
|
|
||
| from dotenv import load_dotenv |
Check failure
Code scanning / Pyre
Undefined import
swarms/structs/aop.py
Outdated
|
|
||
| from loguru import logger | ||
| from mcp.server.fastmcp import FastMCP | ||
| from pydantic import BaseModel, Field |
Check failure
Code scanning / Pyre
Undefined import
swarms/structs/aop.py
Outdated
|
|
||
| # Optional x402 and Starlette imports | ||
| try: | ||
| from starlette.middleware.base import BaseHTTPMiddleware |
Check failure
Code scanning / Pyre
Undefined import
swarms/structs/aop.py
Outdated
| # Optional x402 and Starlette imports | ||
| try: | ||
| from starlette.middleware.base import BaseHTTPMiddleware | ||
| from starlette.requests import Request |
Check failure
Code scanning / Pyre
Undefined import
swarms/structs/aop.py
Outdated
| try: | ||
| from starlette.middleware.base import BaseHTTPMiddleware | ||
| from starlette.requests import Request | ||
| from x402.fastapi.middleware import require_payment |
Check failure
Code scanning / Pyre
Undefined import
swarms/structs/aop.py
Outdated
| X402_AVAILABLE = False | ||
|
|
||
|
|
||
| class PaymentConfig(BaseModel): |
Check failure
Code scanning / Pyre
Undefined or invalid type
swarms/structs/aop.py
Outdated
|
|
||
| if X402_AVAILABLE: | ||
|
|
||
| class X402PaymentMiddleware(BaseHTTPMiddleware): |
Check failure
Code scanning / Pyre
Undefined or invalid type
swarms/structs/aop.py
Outdated
| app: Starlette app instance | ||
| payment_config: Payment configuration with wallet, price, network | ||
| """ | ||
| super().__init__(app) |
Check failure
Code scanning / Pyre
Too many arguments
swarms/structs/aop.py
Outdated
| }, | ||
| ) | ||
|
|
||
| async def dispatch(self, request: Request, call_next): |
Check failure
Code scanning / Pyre
Undefined or invalid type
Thank you for contributing to Swarms!
Replace this comment with:
Please make sure your PR is passing linting and testing before submitting. Run
make format,make lintandmake testto check this locally.See contribution guidelines for more information on how to write/run tests, lint, etc:
https://github.com/kyegomez/swarms/blob/master/CONTRIBUTING.md
If you're adding a new integration, please include:
Maintainer responsibilities:
If no one reviews your PR within a few days, feel free to email Kye at [email protected]
See contribution guidelines for more information on how to write/run tests, lint, etc: https://github.com/kyegomez/swarms
📚 Documentation preview 📚: https://swarms--1175.org.readthedocs.build/en/1175/