smithy-http 0.4.0__tar.gz → 0.4.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- smithy_http-0.4.1/.changes/0.4.1.json +8 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/CHANGELOG.md +5 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/PKG-INFO +2 -1
- {smithy_http-0.4.0 → smithy_http-0.4.1}/pyproject.toml +1 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/src/smithy_http/__init__.py +1 -1
- {smithy_http-0.4.0 → smithy_http-0.4.1}/src/smithy_http/aio/crt.py +23 -7
- {smithy_http-0.4.0 → smithy_http-0.4.1}/.changes/0.0.1.json +0 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/.changes/0.1.0.json +0 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/.changes/0.2.0.json +0 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/.changes/0.2.1.json +0 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/.changes/0.3.0.json +0 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/.changes/0.3.1.json +0 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/.changes/0.4.0.json +0 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/.gitignore +0 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/NOTICE +0 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/README.md +0 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/src/smithy_http/aio/__init__.py +0 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/src/smithy_http/aio/aiohttp.py +0 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/src/smithy_http/aio/auth/__init__.py +0 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/src/smithy_http/aio/auth/apikey.py +0 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/src/smithy_http/aio/identity/__init__.py +0 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/src/smithy_http/aio/identity/apikey.py +0 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/src/smithy_http/aio/interfaces/__init__.py +0 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/src/smithy_http/aio/protocols.py +0 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/src/smithy_http/aio/restjson.py +0 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/src/smithy_http/bindings.py +0 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/src/smithy_http/deserializers.py +0 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/src/smithy_http/endpoints.py +0 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/src/smithy_http/exceptions.py +0 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/src/smithy_http/interceptors/__init__.py +0 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/src/smithy_http/interceptors/user_agent.py +0 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/src/smithy_http/interfaces/__init__.py +0 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/src/smithy_http/plugins/__init__.py +0 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/src/smithy_http/py.typed +0 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/src/smithy_http/restjson.py +0 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/src/smithy_http/serializers.py +0 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/src/smithy_http/testing/__init__.py +0 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/src/smithy_http/testing/mockhttp.py +0 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/src/smithy_http/testing/utils.py +0 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/src/smithy_http/user_agent.py +0 -0
- {smithy_http-0.4.0 → smithy_http-0.4.1}/src/smithy_http/utils.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: smithy-http
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.1
|
|
4
4
|
Summary: HTTP components for Smithy tooling.
|
|
5
5
|
Project-URL: Changelog, https://github.com/smithy-lang/smithy-python/blob/develop/packages/smithy-http/CHANGELOG.md
|
|
6
6
|
Project-URL: Code, https://github.com/smithy-lang/smithy-python/blob/develop/packages/smithy-http/
|
|
@@ -21,6 +21,7 @@ Classifier: Programming Language :: Python :: 3 :: Only
|
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.12
|
|
22
22
|
Classifier: Programming Language :: Python :: 3.13
|
|
23
23
|
Classifier: Programming Language :: Python :: 3.14
|
|
24
|
+
Classifier: Programming Language :: Python :: Free Threading :: 2 - Beta
|
|
24
25
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
25
26
|
Classifier: Topic :: Software Development :: Libraries
|
|
26
27
|
Requires-Python: >=3.12
|
|
@@ -23,6 +23,7 @@ classifiers = [
|
|
|
23
23
|
"Programming Language :: Python :: 3.13",
|
|
24
24
|
"Programming Language :: Python :: 3.14",
|
|
25
25
|
"Programming Language :: Python :: Implementation :: CPython",
|
|
26
|
+
"Programming Language :: Python :: Free Threading :: 2 - Beta",
|
|
26
27
|
"Topic :: Software Development :: Libraries"
|
|
27
28
|
]
|
|
28
29
|
dependencies = [
|
|
@@ -6,6 +6,7 @@ from collections.abc import AsyncGenerator, AsyncIterable
|
|
|
6
6
|
from copy import deepcopy
|
|
7
7
|
from dataclasses import dataclass
|
|
8
8
|
from inspect import iscoroutinefunction
|
|
9
|
+
from io import BytesIO
|
|
9
10
|
from typing import TYPE_CHECKING, Any
|
|
10
11
|
|
|
11
12
|
from awscrt.exceptions import AwsCrtError
|
|
@@ -36,6 +37,7 @@ except ImportError:
|
|
|
36
37
|
from smithy_core import interfaces as core_interfaces
|
|
37
38
|
from smithy_core.aio import interfaces as core_aio_interfaces
|
|
38
39
|
from smithy_core.aio.types import AsyncBytesReader
|
|
40
|
+
from smithy_core.aio.utils import read_streaming_blob_async
|
|
39
41
|
from smithy_core.exceptions import MissingDependencyError
|
|
40
42
|
|
|
41
43
|
from .. import Field, Fields
|
|
@@ -175,13 +177,18 @@ class AWSCRTHTTPClient(http_aio_interfaces.HTTPClient):
|
|
|
175
177
|
crt_request = self._marshal_request(request)
|
|
176
178
|
connection = await self._get_connection(request.destination)
|
|
177
179
|
|
|
178
|
-
#
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
180
|
+
# request_body_generator is HTTP/2-only in CRT; HTTP/1.1 must use body_stream
|
|
181
|
+
if connection.version is crt_http.HttpVersion.Http2:
|
|
182
|
+
crt_stream = connection.request(
|
|
183
|
+
crt_request,
|
|
184
|
+
request_body_generator=self._create_body_generator(request.body),
|
|
185
|
+
)
|
|
186
|
+
else:
|
|
187
|
+
if (
|
|
188
|
+
body_stream := await self._create_body_stream(request.body)
|
|
189
|
+
) is not None:
|
|
190
|
+
crt_request.body_stream = body_stream
|
|
191
|
+
crt_stream = connection.request(crt_request)
|
|
185
192
|
|
|
186
193
|
return await self._await_response(crt_stream)
|
|
187
194
|
except AwsCrtError as e:
|
|
@@ -308,6 +315,15 @@ class AWSCRTHTTPClient(http_aio_interfaces.HTTPClient):
|
|
|
308
315
|
)
|
|
309
316
|
return crt_request
|
|
310
317
|
|
|
318
|
+
async def _create_body_stream(
|
|
319
|
+
self, body: core_aio_interfaces.StreamingBlob
|
|
320
|
+
) -> core_interfaces.BytesReader | None:
|
|
321
|
+
"""Convert various body types to a bytes reader for CRT HTTP/1.1."""
|
|
322
|
+
if core_interfaces.is_bytes_reader(body):
|
|
323
|
+
return body
|
|
324
|
+
buffered = await read_streaming_blob_async(body)
|
|
325
|
+
return BytesIO(buffered) if buffered else None
|
|
326
|
+
|
|
311
327
|
async def _create_body_generator(
|
|
312
328
|
self, body: core_aio_interfaces.StreamingBlob
|
|
313
329
|
) -> AsyncGenerator[bytes, None]:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|