smithy-http 0.4.3__tar.gz → 0.4.4__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.4/.changes/0.4.4.json +16 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/CHANGELOG.md +7 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/PKG-INFO +2 -2
- {smithy_http-0.4.3 → smithy_http-0.4.4}/src/smithy_http/__init__.py +1 -1
- {smithy_http-0.4.3 → smithy_http-0.4.4}/src/smithy_http/aio/aiohttp.py +5 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/src/smithy_http/aio/crt.py +4 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/src/smithy_http/aio/protocols.py +11 -1
- {smithy_http-0.4.3 → smithy_http-0.4.4}/src/smithy_http/testing/mockhttp.py +5 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/.changes/0.0.1.json +0 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/.changes/0.1.0.json +0 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/.changes/0.2.0.json +0 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/.changes/0.2.1.json +0 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/.changes/0.3.0.json +0 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/.changes/0.3.1.json +0 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/.changes/0.4.0.json +0 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/.changes/0.4.1.json +0 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/.changes/0.4.2.json +0 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/.changes/0.4.3.json +0 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/.gitignore +0 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/NOTICE +0 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/README.md +0 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/pyproject.toml +0 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/src/smithy_http/aio/__init__.py +0 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/src/smithy_http/aio/auth/__init__.py +0 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/src/smithy_http/aio/auth/apikey.py +0 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/src/smithy_http/aio/identity/__init__.py +0 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/src/smithy_http/aio/identity/apikey.py +0 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/src/smithy_http/aio/interfaces/__init__.py +0 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/src/smithy_http/aio/restjson.py +0 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/src/smithy_http/bindings.py +0 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/src/smithy_http/deserializers.py +0 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/src/smithy_http/endpoints.py +0 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/src/smithy_http/exceptions.py +0 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/src/smithy_http/interceptors/__init__.py +0 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/src/smithy_http/interceptors/user_agent.py +0 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/src/smithy_http/interfaces/__init__.py +0 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/src/smithy_http/plugins/__init__.py +0 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/src/smithy_http/py.typed +0 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/src/smithy_http/restjson.py +0 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/src/smithy_http/serializers.py +0 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/src/smithy_http/testing/__init__.py +0 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/src/smithy_http/testing/utils.py +0 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/src/smithy_http/user_agent.py +0 -0
- {smithy_http-0.4.3 → smithy_http-0.4.4}/src/smithy_http/utils.py +0 -0
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"changes": [
|
|
3
|
+
{
|
|
4
|
+
"type": "enhancement",
|
|
5
|
+
"description": "Added a protocol hook for extracting server-provided retry delays from error responses."
|
|
6
|
+
},
|
|
7
|
+
{
|
|
8
|
+
"type": "enhancement",
|
|
9
|
+
"description": "Declared `AWSCRTHTTPClient` as duplex (bidirectional) streaming capable via `SUPPORTS_DUPLEX_STREAMING`. `AIOHTTPClient` explicitly does not support duplex streaming."
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"type": "enhancement",
|
|
13
|
+
"description": "Disabled automatic redirects in `AIOHTTPClient` so that redirect responses are returned to the caller instead of being followed transparently."
|
|
14
|
+
}
|
|
15
|
+
]
|
|
16
|
+
}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v0.4.4
|
|
4
|
+
|
|
5
|
+
### Enhancements
|
|
6
|
+
* Added a protocol hook for extracting server-provided retry delays from error responses.
|
|
7
|
+
* Declared `AWSCRTHTTPClient` as duplex (bidirectional) streaming capable via `SUPPORTS_DUPLEX_STREAMING`. `AIOHTTPClient` explicitly does not support duplex streaming.
|
|
8
|
+
* Disabled automatic redirects in `AIOHTTPClient` so that redirect responses are returned to the caller instead of being followed transparently.
|
|
9
|
+
|
|
3
10
|
## v0.4.3
|
|
4
11
|
|
|
5
12
|
### Enhancements
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
2
|
Name: smithy-http
|
|
3
|
-
Version: 0.4.
|
|
3
|
+
Version: 0.4.4
|
|
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/
|
|
@@ -53,6 +53,10 @@ class AIOHTTPClient(HTTPClient):
|
|
|
53
53
|
|
|
54
54
|
TIMEOUT_EXCEPTIONS = (TimeoutError,)
|
|
55
55
|
|
|
56
|
+
# aiohttp has no HTTP/2 support and this client fully buffers the response
|
|
57
|
+
# before returning, so it can never interleave request and response data.
|
|
58
|
+
SUPPORTS_DUPLEX_STREAMING = False
|
|
59
|
+
|
|
56
60
|
def __init__(
|
|
57
61
|
self,
|
|
58
62
|
*,
|
|
@@ -108,6 +112,7 @@ class AIOHTTPClient(HTTPClient):
|
|
|
108
112
|
params=parse_qs(request.destination.query), # type: ignore
|
|
109
113
|
headers=headers_list,
|
|
110
114
|
data=body,
|
|
115
|
+
allow_redirects=False,
|
|
111
116
|
) as resp:
|
|
112
117
|
return await self._marshal_response(resp)
|
|
113
118
|
|
|
@@ -142,6 +142,10 @@ class AWSCRTHTTPClient(http_aio_interfaces.HTTPClient):
|
|
|
142
142
|
|
|
143
143
|
TIMEOUT_EXCEPTIONS = (_CRTTimeoutError,)
|
|
144
144
|
|
|
145
|
+
# CRT can stream request and response data concurrently when the connection
|
|
146
|
+
# negotiates HTTP/2.
|
|
147
|
+
SUPPORTS_DUPLEX_STREAMING = True
|
|
148
|
+
|
|
145
149
|
def __init__(
|
|
146
150
|
self,
|
|
147
151
|
eventloop: _AWSCRTEventLoop | None = None,
|
|
@@ -192,6 +192,8 @@ class HttpBindingClientProtocol(HttpClientProtocol):
|
|
|
192
192
|
error_id=error_id,
|
|
193
193
|
)
|
|
194
194
|
|
|
195
|
+
retry_after = self._retry_after(response)
|
|
196
|
+
|
|
195
197
|
if error_id is None and self._matches_content_type(response):
|
|
196
198
|
if isinstance(response_body, bytearray):
|
|
197
199
|
response_body = bytes(response_body)
|
|
@@ -225,7 +227,10 @@ class HttpBindingClientProtocol(HttpClientProtocol):
|
|
|
225
227
|
response=response,
|
|
226
228
|
body=response_body,
|
|
227
229
|
)
|
|
228
|
-
|
|
230
|
+
modeled_error = error_shape.deserialize(deserializer)
|
|
231
|
+
if retry_after is not None:
|
|
232
|
+
modeled_error.retry_after = retry_after
|
|
233
|
+
return modeled_error
|
|
229
234
|
|
|
230
235
|
message = (
|
|
231
236
|
f"Unknown error for operation {operation.schema.id} "
|
|
@@ -246,8 +251,13 @@ class HttpBindingClientProtocol(HttpClientProtocol):
|
|
|
246
251
|
is_throttling_error=is_throttle,
|
|
247
252
|
is_timeout_error=is_timeout,
|
|
248
253
|
is_retry_safe=is_throttle or is_timeout or None,
|
|
254
|
+
retry_after=retry_after,
|
|
249
255
|
)
|
|
250
256
|
|
|
257
|
+
def _retry_after(self, response: HTTPResponse) -> float | None:
|
|
258
|
+
"""The retry delay in seconds requested by the server, if the response carries one."""
|
|
259
|
+
return None
|
|
260
|
+
|
|
251
261
|
def _resolve_error_id(
|
|
252
262
|
self,
|
|
253
263
|
*,
|
|
@@ -22,6 +22,11 @@ class MockHTTPClient(HTTPClient):
|
|
|
22
22
|
|
|
23
23
|
TIMEOUT_EXCEPTIONS = (TimeoutError,)
|
|
24
24
|
|
|
25
|
+
# Declared so duplex (bidirectional) stream operations can be unit tested
|
|
26
|
+
# against this client. Queued responses are returned without consuming the
|
|
27
|
+
# request body, which is compatible with duplex streaming.
|
|
28
|
+
SUPPORTS_DUPLEX_STREAMING = True
|
|
29
|
+
|
|
25
30
|
def __init__(
|
|
26
31
|
self,
|
|
27
32
|
*,
|
|
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
|
|
File without changes
|