finalsa-common-http-client 0.1.1__py3-none-any.whl → 0.1.3__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.
- finalsa/http/_shared.py +2 -2
- finalsa/http/async_client/base.py +6 -3
- finalsa/http/sync_client/base.py +5 -5
- {finalsa_common_http_client-0.1.1.dist-info → finalsa_common_http_client-0.1.3.dist-info}/METADATA +1 -1
- finalsa_common_http_client-0.1.3.dist-info/RECORD +10 -0
- finalsa_common_http_client-0.1.1.dist-info/RECORD +0 -10
- {finalsa_common_http_client-0.1.1.dist-info → finalsa_common_http_client-0.1.3.dist-info}/WHEEL +0 -0
- {finalsa_common_http_client-0.1.1.dist-info → finalsa_common_http_client-0.1.3.dist-info}/licenses/LICENSE.md +0 -0
finalsa/http/_shared.py
CHANGED
|
@@ -77,9 +77,9 @@ def parse_params(params: Mapping[str, Any] | None ) -> dict[str, str | int | flo
|
|
|
77
77
|
if value is not None:
|
|
78
78
|
result[key] = value
|
|
79
79
|
if isinstance(value, dict):
|
|
80
|
-
result[key] = dumps(value)
|
|
80
|
+
result[key] = dumps(value).decode('utf-8')
|
|
81
81
|
if isinstance(value, list):
|
|
82
|
-
result[key] = dumps(value)
|
|
82
|
+
result[key] = dumps(value).decode('utf-8')
|
|
83
83
|
return result
|
|
84
84
|
|
|
85
85
|
|
|
@@ -124,8 +124,7 @@ class BaseAsyncHttpClient:
|
|
|
124
124
|
)
|
|
125
125
|
merged_headers = shared.merge_headers(self._default_headers, headers)
|
|
126
126
|
request_timeout = self._normalize_timeout(timeout) or self._timeout
|
|
127
|
-
self._logger.info(f"{method.upper()} request to {resolved_url}", extra={
|
|
128
|
-
"headers": merged_headers, "timeout": request_timeout, "params": params})
|
|
127
|
+
self._logger.info(f"{method.upper()} request to {resolved_url}", extra={"timeout": request_timeout, "params": params})
|
|
129
128
|
start_time = time.time()
|
|
130
129
|
response = await session.request(
|
|
131
130
|
method.upper(),
|
|
@@ -181,7 +180,11 @@ class BaseAsyncHttpClient:
|
|
|
181
180
|
return self._session
|
|
182
181
|
|
|
183
182
|
async def get_paginated(self, path: str, pagination_request: PaginationRequest, response_model: Type[BaseModel], **kwargs: Any) -> PaginationResponse[Type[BaseModel]]:
|
|
184
|
-
|
|
183
|
+
pagination_request_dict = pagination_request.model_dump()
|
|
184
|
+
if 'exclusive_start_key' in pagination_request_dict:
|
|
185
|
+
pagination_request_dict['from'] = pagination_request_dict['exclusive_start_key']
|
|
186
|
+
pagination_request_dict.pop('exclusive_start_key')
|
|
187
|
+
response = await self.get(path, params=pagination_request_dict, **kwargs)
|
|
185
188
|
data = await response.json()
|
|
186
189
|
items = [response_model.model_validate_json(
|
|
187
190
|
item) for item in data["items"]]
|
finalsa/http/sync_client/base.py
CHANGED
|
@@ -106,7 +106,7 @@ class BaseSyncHttpClient:
|
|
|
106
106
|
request_timeout = timeout if timeout is not None else self._timeout
|
|
107
107
|
try:
|
|
108
108
|
self._logger.info(f"{method.upper()} request to {resolved_url}", extra={
|
|
109
|
-
"
|
|
109
|
+
"timeout": request_timeout, "params": params})
|
|
110
110
|
start_time = time.time()
|
|
111
111
|
response = session.request(
|
|
112
112
|
method.upper(),
|
|
@@ -128,12 +128,12 @@ class BaseSyncHttpClient:
|
|
|
128
128
|
except requests.RequestException as e:
|
|
129
129
|
if e.response is not None and "Content-Type" in e.response.headers and e.response.headers["Content-Type"] == "application/json":
|
|
130
130
|
data = e.response.json()
|
|
131
|
-
self._logger.error(f"
|
|
132
|
-
"status": e.response.status_code, "
|
|
131
|
+
self._logger.error(f"Response error with status {e.response.status_code}", extra={
|
|
132
|
+
"status": e.response.status_code, "body": data})
|
|
133
133
|
shared.raise_for_response(data, e.response.status_code)
|
|
134
134
|
|
|
135
|
-
self._logger.error(f"
|
|
136
|
-
"status": e.response.status_code
|
|
135
|
+
self._logger.error(f"Response error with status {e.response.status_code}", extra={
|
|
136
|
+
"status": e.response.status_code})
|
|
137
137
|
raise e
|
|
138
138
|
|
|
139
139
|
def get(self, path: str, **kwargs: Any) -> requests.Response:
|
{finalsa_common_http_client-0.1.1.dist-info → finalsa_common_http_client-0.1.3.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: finalsa-common-http-client
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.3
|
|
4
4
|
Summary: HTTP client library for common data types used in business applications
|
|
5
5
|
Project-URL: Homepage, https://github.com/finalsa/finalsa-http-client
|
|
6
6
|
Project-URL: Documentation, https://github.com/finalsa/finalsa-http-client#readme
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
finalsa/http/__init__.py,sha256=w6M9CRcx2gCy1u-HLhLZ_0kQX92JEbFiGi4MBYqR3OI,498
|
|
2
|
+
finalsa/http/_shared.py,sha256=lIUwPSg3uZY9viTJ_KDbhHLQGw8PiQGtINFGJekJkWc,5278
|
|
3
|
+
finalsa/http/async_client/__init__.py,sha256=L25WfVpUpPZlMv6-cgeWlNvmK5UJOhLZ1NOndcIsA9w,73
|
|
4
|
+
finalsa/http/async_client/base.py,sha256=XPgv3Ux3L9HZ166b6g2f7tbe5pnuBl5hKfOpX6TEBjU,7812
|
|
5
|
+
finalsa/http/sync_client/__init__.py,sha256=ocLE6dofwYCD9_rJpIP1KhlIujRFcaJfhoaeXVrSCVE,59
|
|
6
|
+
finalsa/http/sync_client/base.py,sha256=uH9CNAkg-Lyjoj_kx7mTEotcivYq7fQpHcWxWWM_Pro,6624
|
|
7
|
+
finalsa_common_http_client-0.1.3.dist-info/METADATA,sha256=2hYnkJQ3fnIcaOEgW1xJzn-xy5Qyuf6lqm_poMLYigA,9102
|
|
8
|
+
finalsa_common_http_client-0.1.3.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
9
|
+
finalsa_common_http_client-0.1.3.dist-info/licenses/LICENSE.md,sha256=yqzhfnTBr2S4lUBx-yibVPOIXRUDPrSUN9-_7AsC6OU,1084
|
|
10
|
+
finalsa_common_http_client-0.1.3.dist-info/RECORD,,
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
finalsa/http/__init__.py,sha256=w6M9CRcx2gCy1u-HLhLZ_0kQX92JEbFiGi4MBYqR3OI,498
|
|
2
|
-
finalsa/http/_shared.py,sha256=N3lH8m7hCHLTRCDASi2U8-TCweuEIfKQDVtMQgX_j38,5246
|
|
3
|
-
finalsa/http/async_client/__init__.py,sha256=L25WfVpUpPZlMv6-cgeWlNvmK5UJOhLZ1NOndcIsA9w,73
|
|
4
|
-
finalsa/http/async_client/base.py,sha256=vfARqtUzVvcauzkKk12oDPwJhi2i2FGPBigJ6iNGuxM,7591
|
|
5
|
-
finalsa/http/sync_client/__init__.py,sha256=ocLE6dofwYCD9_rJpIP1KhlIujRFcaJfhoaeXVrSCVE,59
|
|
6
|
-
finalsa/http/sync_client/base.py,sha256=9pNFcUEtBQqnq-rT_-1MfqKBV5Ao9vMDwm-YpE9zvmo,6719
|
|
7
|
-
finalsa_common_http_client-0.1.1.dist-info/METADATA,sha256=6axN3uFRYb5--wetiyeoq6n2YU0d4PfOY8sfTjjENr4,9102
|
|
8
|
-
finalsa_common_http_client-0.1.1.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
9
|
-
finalsa_common_http_client-0.1.1.dist-info/licenses/LICENSE.md,sha256=yqzhfnTBr2S4lUBx-yibVPOIXRUDPrSUN9-_7AsC6OU,1084
|
|
10
|
-
finalsa_common_http_client-0.1.1.dist-info/RECORD,,
|
{finalsa_common_http_client-0.1.1.dist-info → finalsa_common_http_client-0.1.3.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|