smithy-http-0.4.0
توضیحات
HTTP components for Smithy tooling.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | OS Independent |
| نام فایل | smithy-http-0.4.0 |
| نام | smithy-http |
| نسخه کتابخانه | 0.4.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | Amazon Web Services |
| ایمیل نویسنده | - |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/smithy-http/ |
| مجوز | Apache License 2.0 |
# smithy-http
This package provides primitives and interfaces for http functionality in tooling generated by Smithy.
---
## Testing
The `smithy_http.testing` module provides shared utilities for testing HTTP functionality in smithy-python clients.
### MockHTTPClient
The `MockHTTPClient` allows you to test smithy-python clients without making actual network calls. It implements the `HTTPClient` interface and provides configurable responses for functional testing.
#### Basic Usage
```python
from smithy_http.testing import MockHTTPClient
# Create mock client and configure responses
mock_client = MockHTTPClient()
mock_client.add_response(
status=200,
headers=[("Content-Type", "application/json")],
body=b'{"message": "success"}'
)
# Use with your smithy-python client
config = Config(transport=mock_client)
client = TestSmithyServiceClient(config=config)
# Test your client logic
result = await client.some_operation({"input": "data"})
# Inspect what requests were made
assert mock_client.call_count == 1
captured_request = mock_client.captured_requests[0]
assert result.message == "success"
```
### Utilities
- `create_test_request()`: Helper for creating test HTTPRequest objects
- `MockHTTPClientError`: Exception raised when no responses are queued
نیازمندی
| مقدار | نام |
|---|---|
| - | smithy-core |
| xtr | aiohttp<4.0,>=3.11.12; |
| xtr | yarl; |
| xtr | awscrt~=0.32.0; |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.12 | Python |
نحوه نصب
نصب پکیج whl smithy-http-0.4.0:
pip install smithy-http-0.4.0.whl
نصب پکیج tar.gz smithy-http-0.4.0:
pip install smithy-http-0.4.0.tar.gz