Last active
January 14, 2026 10:53
-
-
Save barseghyanartur/f6e2b74b31639961a2a9404db70b44cc to your computer and use it in GitHub Desktop.
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
| """ | |
| # /// script | |
| # requires-python = ">=3.11" | |
| # dependencies = [ | |
| # "clientele", | |
| # "pydantic", | |
| # "ipython", | |
| # ] | |
| # /// | |
| Quick start | |
| =========== | |
| Prerequisites for testing | |
| ------------------------- | |
| 1. Install `mcpo` and `fake-py-mcp` to have a test API running instantly | |
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | |
| .. code-block:: sh | |
| uv tool install mcpo | |
| uv tool install fake-py-mcp | |
| 2. Run a test API | |
| ~~~~~~~~~~~~~~~~~ | |
| .. code-block:: sh | |
| mcpo --port 8006 -- fake-py-mcp | |
| Test the API | |
| ------------ | |
| .. code-block:: sh | |
| uv run clientele_api_example.py | |
| """ | |
| from clientele import api, cache | |
| from pydantic import BaseModel | |
| client = api.APIClient(base_url="http://localhost:8006") | |
| class ImageUrlData(BaseModel): | |
| width: int | |
| height: int | |
| @client.post("/name") | |
| def get_name(result: str) -> str: | |
| return result | |
| @client.post("/image_url") | |
| def get_image_url(data: ImageUrlData, result: str) -> str: | |
| return result | |
| @client.post("/image_url") | |
| def get_image_url_v2(data: dict, result: str) -> str: | |
| return result | |
| print(get_name()) | |
| print(get_image_url(ImageUrlData(width=800, height=600))) | |
| print(get_image_url_v2({"width": 800, "height": 600})) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment