port-ocean 0.4.6__py3-none-any.whl → 0.4.7__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.
Potentially problematic release.
This version of port-ocean might be problematic. Click here for more details.
- port_ocean/clients/port/retry_transport.py +5 -0
- port_ocean/clients/port/utils.py +16 -1
- port_ocean/helpers/retry.py +4 -1
- {port_ocean-0.4.6.dist-info → port_ocean-0.4.7.dist-info}/METADATA +1 -1
- {port_ocean-0.4.6.dist-info → port_ocean-0.4.7.dist-info}/RECORD +8 -8
- {port_ocean-0.4.6.dist-info → port_ocean-0.4.7.dist-info}/LICENSE.md +0 -0
- {port_ocean-0.4.6.dist-info → port_ocean-0.4.7.dist-info}/WHEEL +0 -0
- {port_ocean-0.4.6.dist-info → port_ocean-0.4.7.dist-info}/entry_points.txt +0 -0
|
@@ -15,6 +15,11 @@ class TokenRetryTransport(RetryTransport):
|
|
|
15
15
|
super().__init__(*args, **kwargs)
|
|
16
16
|
self.port_client = port_client
|
|
17
17
|
|
|
18
|
+
def _is_retryable_method(self, request: httpx.Request) -> bool:
|
|
19
|
+
return super()._is_retryable_method(request) or request.url.path.endswith(
|
|
20
|
+
"/auth/access_token"
|
|
21
|
+
)
|
|
22
|
+
|
|
18
23
|
async def _handle_unauthorized(self, response: httpx.Response) -> None:
|
|
19
24
|
token = await self.port_client.auth.token
|
|
20
25
|
response.headers["Authorization"] = f"Bearer {token}"
|
port_ocean/clients/port/utils.py
CHANGED
|
@@ -12,6 +12,19 @@ if TYPE_CHECKING:
|
|
|
12
12
|
_http_client: LocalStack[httpx.AsyncClient] = LocalStack()
|
|
13
13
|
|
|
14
14
|
|
|
15
|
+
# In case the framework sends more requests to port in parallel then allowed by the limits, a PoolTimeout exception will
|
|
16
|
+
# be raised.
|
|
17
|
+
# Raising defaults for the timeout, in addition to the limits, will allow request to wait for a connection for a longer
|
|
18
|
+
# period of time, before raising an exception.
|
|
19
|
+
# We don't want to set the max_connections too highly, as it will cause the application to run out of memory.
|
|
20
|
+
# We also don't want to set the max_keepalive_connections too highly, as it will cause the application to run out of
|
|
21
|
+
# available connections.
|
|
22
|
+
PORT_HTTP_CLIENT_TIMEOUT = httpx.Timeout(10.0)
|
|
23
|
+
PORT_HTTP_CLIENT_CONNECTIONS_LIMIT = httpx.Limits(
|
|
24
|
+
max_connections=200, max_keepalive_connections=50
|
|
25
|
+
)
|
|
26
|
+
|
|
27
|
+
|
|
15
28
|
def _get_http_client_context(port_client: "PortClient") -> httpx.AsyncClient:
|
|
16
29
|
client = _http_client.top
|
|
17
30
|
if client is None:
|
|
@@ -20,7 +33,9 @@ def _get_http_client_context(port_client: "PortClient") -> httpx.AsyncClient:
|
|
|
20
33
|
port_client,
|
|
21
34
|
httpx.AsyncHTTPTransport(),
|
|
22
35
|
logger=logger,
|
|
23
|
-
)
|
|
36
|
+
),
|
|
37
|
+
timeout=PORT_HTTP_CLIENT_TIMEOUT,
|
|
38
|
+
limits=PORT_HTTP_CLIENT_CONNECTIONS_LIMIT,
|
|
24
39
|
)
|
|
25
40
|
_http_client.push(client)
|
|
26
41
|
|
port_ocean/helpers/retry.py
CHANGED
|
@@ -151,7 +151,7 @@ class RetryTransport(httpx.AsyncBaseTransport, httpx.BaseTransport):
|
|
|
151
151
|
|
|
152
152
|
"""
|
|
153
153
|
transport: httpx.AsyncBaseTransport = self._wrapped_transport # type: ignore
|
|
154
|
-
if
|
|
154
|
+
if self._is_retryable_method(request):
|
|
155
155
|
send_method = partial(transport.handle_async_request)
|
|
156
156
|
response = await self._retry_operation_async(request, send_method)
|
|
157
157
|
else:
|
|
@@ -178,6 +178,9 @@ class RetryTransport(httpx.AsyncBaseTransport, httpx.BaseTransport):
|
|
|
178
178
|
transport: httpx.BaseTransport = self._wrapped_transport # type: ignore
|
|
179
179
|
transport.close()
|
|
180
180
|
|
|
181
|
+
def _is_retryable_method(self, request: httpx.Request) -> bool:
|
|
182
|
+
return request.method in self._retryable_methods
|
|
183
|
+
|
|
181
184
|
def _should_retry(self, response: httpx.Response) -> bool:
|
|
182
185
|
return response.status_code in self._retry_status_codes
|
|
183
186
|
|
|
@@ -41,9 +41,9 @@ port_ocean/clients/port/mixins/blueprints.py,sha256=vp7kVzr704fCcp6Cvuwv4LR1GeM_
|
|
|
41
41
|
port_ocean/clients/port/mixins/entities.py,sha256=YIu4saILm3-3ArvQTm_vJJa6oTTDCMVFwXAi5qcmpYc,5576
|
|
42
42
|
port_ocean/clients/port/mixins/integrations.py,sha256=FuDoQfQnfJvhK-nKpftQ8k7VsB9odNRlkMkGCmxwaWY,4280
|
|
43
43
|
port_ocean/clients/port/mixins/migrations.py,sha256=M93i_aryfDazRHjkpTS3-sV3UshLCxmsv6yAIOziFl8,1463
|
|
44
|
-
port_ocean/clients/port/retry_transport.py,sha256=
|
|
44
|
+
port_ocean/clients/port/retry_transport.py,sha256=6p64Ek8vpe0hHVcrNIXij8KQ9K2zwPuMUnJp2R8ZYUI,2075
|
|
45
45
|
port_ocean/clients/port/types.py,sha256=nvlgiAq4WH5_F7wQbz_GAWl-faob84LVgIjZ2Ww5mTk,451
|
|
46
|
-
port_ocean/clients/port/utils.py,sha256=
|
|
46
|
+
port_ocean/clients/port/utils.py,sha256=x20rtGgnYodklU8AcndF93fI4R58ggExxc9gvpiVeq0,2273
|
|
47
47
|
port_ocean/config/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
48
48
|
port_ocean/config/base.py,sha256=e1oW66ynjo7Sp2PcLBp9aCzj59JpTaiKUXVJK8VB8TA,5540
|
|
49
49
|
port_ocean/config/dynamic.py,sha256=CIRDnqFUPSnNMLZ-emRCMVAjEQNBlIujhZ7OGwi_aKs,1816
|
|
@@ -103,7 +103,7 @@ port_ocean/exceptions/context.py,sha256=qC1OLppiv6XZuXSHRO2P_VPFSzrc_uUQNvfSYLeA
|
|
|
103
103
|
port_ocean/exceptions/core.py,sha256=ygxtPQ9IG8NzIrzZok5OqkefVrqcC4bjZ-2Vf9IPZuA,790
|
|
104
104
|
port_ocean/exceptions/port_defaults.py,sha256=R3ufJcfllb7NZSwHOpBs8kbjsIZVQLM6vKO6dz4w-EE,407
|
|
105
105
|
port_ocean/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
106
|
-
port_ocean/helpers/retry.py,sha256=
|
|
106
|
+
port_ocean/helpers/retry.py,sha256=xrkXeVBHk1yIM6yVse5DpDZJMUj310ZpXqHFZFzCFRM,13171
|
|
107
107
|
port_ocean/logger_setup.py,sha256=dOA58ZBAfe9dcAoBybXFWgDfsJG-uIX1ABI0r2CyUG8,1160
|
|
108
108
|
port_ocean/middlewares.py,sha256=8rGu9XSKvbNCQGzWvfaijDrp-0ATJrWAQfBji2CnSck,2475
|
|
109
109
|
port_ocean/ocean.py,sha256=9dFBf46N6fht6ibQUjnDDizY-p0qa0Uw-415JTDQmus,3626
|
|
@@ -111,8 +111,8 @@ port_ocean/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
111
111
|
port_ocean/run.py,sha256=xvYZlfi-J-IcqsAg8tNVnvl1mEUr6wPSya_-Bbf6jAU,1811
|
|
112
112
|
port_ocean/utils.py,sha256=ZQCdOk1DzAA3hwUxFAzmbxQurnNYGpl1bDsPocJSkko,6129
|
|
113
113
|
port_ocean/version.py,sha256=2ugCk8TXPsRIuFviZ8j3RPaszSw2HE-KuaW8vhgWJVM,172
|
|
114
|
-
port_ocean-0.4.
|
|
115
|
-
port_ocean-0.4.
|
|
116
|
-
port_ocean-0.4.
|
|
117
|
-
port_ocean-0.4.
|
|
118
|
-
port_ocean-0.4.
|
|
114
|
+
port_ocean-0.4.7.dist-info/LICENSE.md,sha256=WNHhf_5RCaeuKWyq_K39vmp9F28LxKsB4SpomwSZ2L0,11357
|
|
115
|
+
port_ocean-0.4.7.dist-info/METADATA,sha256=p4Ch4rizkk1-mBpAXRsyBSRaQAdQ6CNhfDt7ohkggdQ,6490
|
|
116
|
+
port_ocean-0.4.7.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
|
|
117
|
+
port_ocean-0.4.7.dist-info/entry_points.txt,sha256=F_DNUmGZU2Kme-8NsWM5LLE8piGMafYZygRYhOVtcjA,54
|
|
118
|
+
port_ocean-0.4.7.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|