You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+51-2Lines changed: 51 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -18,10 +18,10 @@ supporting both synchronous and asynchronous operations.
18
18
- ⚡ **Async/Sync support**: Work with both synchronous and asynchronous HTTP operations
19
19
- 🎯 **Decorator-based API**: Clean, intuitive API definition with decorators
20
20
- 📝 **OpenAPI/Swagger support**: Generate client code from OpenAPI specifications
21
-
- 🛡️ **Automatic validation**: Request/response validation with Pydantic models
21
+
- 🛡️ **Mock API Responses**: This is useful for testing or development purposes.
22
22
- ⚡ **Timing context manager**: Use `with client.span(prefix="myapi"):` to log timing for any API call, sync or async
23
-
- 🔧 **Flexible configuration**: Easy client configuration with headers, timeouts, and more
24
23
- 🔧 **convert api to llm tools**: API2Tools, support `agno`, others coming soon...
24
+
- 🌟 **Nested Response Extraction**: Extract and parse deeply nested API responses using JSON path expressions
25
25
26
26
## TODO
27
27
@@ -44,6 +44,7 @@ See the [`example/`](./example/) directory for real-world usage of this library,
44
44
-`example_httpx.py`: Async usage with HttpxWebClient
45
45
-`example_aiohttp.py`: Async usage with AiohttpWebClient
46
46
-`example_tools.py`: How to register and use Agno tools
47
+
-`example_nested_response.py`: How to extract data from nested API responses
47
48
48
49
49
50
## Quick Start
@@ -169,6 +170,52 @@ user = client.get_user("123")
169
170
170
171
```
171
172
173
+
## Handling Nested API Responses
174
+
175
+
Many APIs return deeply nested JSON structures. Use the `response_extract_path` parameter to extract and parse specific data from complex API responses:
176
+
177
+
```python
178
+
from typing import List
179
+
from pydantic import BaseModel
180
+
from pydantic_client import RequestsWebClient, get
0 commit comments