capo-lambda-core 0.3.0__py3-none-any.whl → 0.4.0__py3-none-any.whl

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.
@@ -17,7 +17,7 @@ import hmac
17
17
  import re
18
18
  from collections.abc import AsyncIterator, Iterator
19
19
  from typing import Any, Literal, TypedDict, cast
20
- from urllib.parse import quote, unquote
20
+ from urllib.parse import quote
21
21
 
22
22
  import zapros
23
23
  from pywhatwgurl import URLSearchParams
@@ -134,11 +134,11 @@ def _remove_dot_segments(path: str) -> str:
134
134
  def _canonical_path(path: str, *, double_encode: bool, normalize: bool) -> str:
135
135
  """Build CanonicalURI.
136
136
 
137
- Per the SigV4 spec, every segment is URI-encoded; standard services
138
- normalize dot segments and URI-encode each segment **twice**. The
139
- rules-engine ``disableNormalizePath`` / ``disableDoubleEncoding`` flags
140
- turn those steps off — S3-family services set both, so the path is
141
- signed exactly as provided.
137
+ ``path`` is the path as sent on the wire, so it is already URI-encoded
138
+ once. Standard services normalize dot segments and URI-encode each
139
+ segment a second time. The rules-engine ``disableNormalizePath`` /
140
+ ``disableDoubleEncoding`` flags turn those steps off — S3-family
141
+ services set both, so the path is signed exactly as provided.
142
142
  """
143
143
  if not path:
144
144
  return "/"
@@ -148,9 +148,9 @@ def _canonical_path(path: str, *, double_encode: bool, normalize: bool) -> str:
148
148
  path = _remove_dot_segments(path)
149
149
  if not double_encode:
150
150
  return path
151
- decoded = unquote(path)
152
- first = quote(decoded, safe="/~")
153
- return quote(first, safe="/~")
151
+ # Never decode first: that would turn a "%2F" inside a segment (an ARN in
152
+ # a path label) into a separator and leave it out of the second encoding.
153
+ return quote(path, safe="/~")
154
154
 
155
155
 
156
156
  def _canonical_query(query: str) -> str:
@@ -95,9 +95,12 @@ class AsyncLambdaCoreClient:
95
95
  credentials_provider: CredentialsProvider | None = None,
96
96
  anonymous: bool | None = None,
97
97
  ):
98
- self._client = AsyncClient(http_handler).wrap_with_middleware(
99
- lambda next: AuthMiddleware(next)
100
- )
98
+ client = AsyncClient(http_handler)
99
+ # The handler the user gave us, or the default one for this environment.
100
+ # The SDK middlewares wrap it below, and the credential resolvers borrow
101
+ # it for their one-off calls.
102
+ raw_handler = client.handler
103
+ self._client = client.wrap_with_middleware(lambda next: AuthMiddleware(next))
101
104
  if credentials is not None and credentials_provider is not None:
102
105
  warnings.warn(
103
106
  "Both credentials and credentials_provider given; provider takes precedence"
@@ -109,7 +112,7 @@ class AsyncLambdaCoreClient:
109
112
  resolved_credentials_provider = StaticAwsCredentialsProvider(credentials)
110
113
  if resolved_credentials_provider is None and credentials is None:
111
114
  resolved_credentials_provider = default_aws_credentials_chain(
112
- AsyncClient(http_handler)
115
+ AsyncClient(raw_handler)
113
116
  )
114
117
  self._config = AsyncLambdaCoreClientConfig(
115
118
  {
@@ -95,9 +95,12 @@ class LambdaCoreClient:
95
95
  credentials_provider: CredentialsProvider | None = None,
96
96
  anonymous: bool | None = None,
97
97
  ):
98
- self._client = Client(http_handler).wrap_with_middleware(
99
- lambda next: AuthMiddleware(next)
100
- )
98
+ client = Client(http_handler)
99
+ # The handler the user gave us, or the default one for this environment.
100
+ # The SDK middlewares wrap it below, and the credential resolvers borrow
101
+ # it for their one-off calls.
102
+ raw_handler = client.handler
103
+ self._client = client.wrap_with_middleware(lambda next: AuthMiddleware(next))
101
104
  if credentials is not None and credentials_provider is not None:
102
105
  warnings.warn(
103
106
  "Both credentials and credentials_provider given; provider takes precedence"
@@ -109,7 +112,7 @@ class LambdaCoreClient:
109
112
  resolved_credentials_provider = StaticAwsCredentialsProvider(credentials)
110
113
  if resolved_credentials_provider is None and credentials is None:
111
114
  resolved_credentials_provider = default_aws_credentials_chain(
112
- Client(http_handler)
115
+ Client(raw_handler)
113
116
  )
114
117
  self._config = LambdaCoreClientConfig(
115
118
  {
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: capo-lambda-core
3
- Version: 0.3.0
3
+ Version: 0.4.0
4
4
  Summary: Python SDK for AWS Lambda Core.
5
5
  Classifier: Development Status :: 4 - Beta
6
6
  Classifier: Intended Audience :: Developers
@@ -17,7 +17,7 @@ Classifier: Typing :: Typed
17
17
  Requires-Python: >=3.10
18
18
  Description-Content-Type: text/markdown
19
19
  License-File: LICENSE
20
- Requires-Dist: zapros>=0.13.0
20
+ Requires-Dist: zapros>=0.21.0
21
21
  Provides-Extra: anyio
22
22
  Requires-Dist: anyio>=3.0; extra == "anyio"
23
23
  Provides-Extra: sso
@@ -7,7 +7,7 @@ capo_lambda_core/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
7
  capo_lambda_core/_auth/_identity.py,sha256=ONv_NxU5ShEezSRyGAKGaxAn0R1HLGktZqKrL7xsPZw,326
8
8
  capo_lambda_core/_auth/_providers.py,sha256=L3nWWsx5C9THHTsHAadWi8bHYZLeChizCmZXziRR20A,33684
9
9
  capo_lambda_core/_auth/_signers.py,sha256=y3CBvzVRkAZ0nYg5br_HFkpKWklQE6zbca5HVCexD9o,4962
10
- capo_lambda_core/_auth/_sigv4.py,sha256=pi77jPo3cZzGXTpgKn4P6se45Rk-KjJeULF7yfBFOcg,20617
10
+ capo_lambda_core/_auth/_sigv4.py,sha256=4Zu1I9lXRTjt_CeEqrySWys72sAKtDM1FSVpi8u9Y6Q,20728
11
11
  capo_lambda_core/_auth/_zapros_handler.py,sha256=8xdfKJH-rJB2fFNajj7v5JlSn06u9ZUoOmgqUh2jptA,2978
12
12
  capo_lambda_core/_operations/lambda_core_api_service/create_network_connector.py,sha256=B_xdFr0XOEt_zqxeJVzaJCoMFOXDdbr3NH8zhdWMDVQ,6970
13
13
  capo_lambda_core/_operations/lambda_core_api_service/delete_network_connector.py,sha256=OF7bIFmNfZc9afP7-tHzw8xr5bFcAzTzJruMWXHcN5g,6800
@@ -26,8 +26,8 @@ capo_lambda_core/_rule_engine/_endpoint_rule_set.py,sha256=u3ySxDh5YWDm3WGxOxAb3
26
26
  capo_lambda_core/_rule_engine/_endpoint_runtime.py,sha256=o94904z9c3fuJJD7vDrl_k1b9nWLueMKAXB6-OxL1Fs,13797
27
27
  capo_lambda_core/_services/_aws_config.py,sha256=rcNWCI9N9AWCsBZ4nnyhz2f513o9esWOOUnwU5MCp1g,5203
28
28
  capo_lambda_core/_services/_pipeline.py,sha256=rYP5bKY9F9VnYha0m3ttOL0j_OLkTTja2dzwuWHHB14,8058
29
- capo_lambda_core/_services/async_lambda_core.py,sha256=bKTC5aUeq87dmWaIXLL5kEBkAU9ualBh5lu-14aing4,29209
30
- capo_lambda_core/_services/lambda_core.py,sha256=bY5-ORCJCrEGapQCmzd1KJgPZt194BLXV_VJqKSenYQ,28681
29
+ capo_lambda_core/_services/async_lambda_core.py,sha256=6Pwf3pOZ4RrW4iwTLQN7E-pMPxiqVg_F9xpcx4beHC4,29447
30
+ capo_lambda_core/_services/lambda_core.py,sha256=7-vsAVgPF5QuM6Xdynv9oLj6hjqpe8ElSYL-pTfzy5o,28919
31
31
  capo_lambda_core/errors/__init__.py,sha256=uuzIG5uMlesW1UnXndNgsNpe-tZiCFSS_UFeZHieFb0,1154
32
32
  capo_lambda_core/errors/_base.py,sha256=7RwU3dOATtaJ6mhJo8Mn3ledn_48aFJgKU2ZHM3F5mY,3034
33
33
  capo_lambda_core/errors/invalid_parameter_value_exception.py,sha256=LIOcXd089ZB6sOisAsk8Gd4yoUq8o0jHGpIAf4-Wsm4,1836
@@ -79,8 +79,8 @@ capo_lambda_core/types/update_network_connector_request.py,sha256=WjmQ7dbyKw-h58
79
79
  capo_lambda_core/types/update_network_connector_response.py,sha256=-qzPoPTfMCRyg9Upb3PrAxs84lcl2deMGeevKe3uukQ,5887
80
80
  capo_lambda_core/types/_prelude/blob.py,sha256=L57RpNwdTSboMhnddA-0PBonXBu3oPm3RAr4Ff7IjzQ,277
81
81
  capo_lambda_core/types/_prelude/timestamp.py,sha256=wfGPIPU-oBc2-PPqjNnJIElt1jXcEdb78Ux6jSX1mu0,487
82
- capo_lambda_core-0.3.0.dist-info/licenses/LICENSE,sha256=sOQjPuig7ktMdOZpG1TdsPSYAVS_9UYVXwDDbD75nVI,1072
83
- capo_lambda_core-0.3.0.dist-info/METADATA,sha256=kk4gVHZSi_QTtNbegtpglgXE6xNrHxJoKWs7S0_O52Q,3552
84
- capo_lambda_core-0.3.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
85
- capo_lambda_core-0.3.0.dist-info/top_level.txt,sha256=5SOL6GmRwmGKsZnqDRXU_wnO0da1632SLMxYJflxe3E,17
86
- capo_lambda_core-0.3.0.dist-info/RECORD,,
82
+ capo_lambda_core-0.4.0.dist-info/licenses/LICENSE,sha256=sOQjPuig7ktMdOZpG1TdsPSYAVS_9UYVXwDDbD75nVI,1072
83
+ capo_lambda_core-0.4.0.dist-info/METADATA,sha256=e6Encj9b56kWovVuiZbOrCuVKfkI_XIGg-j50kaXeWc,3552
84
+ capo_lambda_core-0.4.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
85
+ capo_lambda_core-0.4.0.dist-info/top_level.txt,sha256=5SOL6GmRwmGKsZnqDRXU_wnO0da1632SLMxYJflxe3E,17
86
+ capo_lambda_core-0.4.0.dist-info/RECORD,,