port-ocean 0.4.5__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/config/settings.py +5 -1
- port_ocean/core/defaults/initialize.py +2 -3
- port_ocean/helpers/retry.py +4 -1
- {port_ocean-0.4.5.dist-info → port_ocean-0.4.7.dist-info}/METADATA +1 -1
- {port_ocean-0.4.5.dist-info → port_ocean-0.4.7.dist-info}/RECORD +10 -10
- {port_ocean-0.4.5.dist-info → port_ocean-0.4.7.dist-info}/LICENSE.md +0 -0
- {port_ocean-0.4.5.dist-info → port_ocean-0.4.7.dist-info}/WHEEL +0 -0
- {port_ocean-0.4.5.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/config/settings.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
from typing import Any, Literal
|
|
2
2
|
|
|
3
|
-
from pydantic import BaseSettings, BaseModel, Extra, AnyHttpUrl, parse_obj_as
|
|
3
|
+
from pydantic import BaseSettings, BaseModel, Extra, AnyHttpUrl, parse_obj_as, validator
|
|
4
4
|
|
|
5
5
|
from port_ocean.config.base import BaseOceanSettings
|
|
6
6
|
from port_ocean.core.event_listener import EventListenerSettingsType
|
|
@@ -33,6 +33,10 @@ class IntegrationSettings(BaseModel, extra=Extra.allow):
|
|
|
33
33
|
type: str
|
|
34
34
|
config: dict[str, Any]
|
|
35
35
|
|
|
36
|
+
@validator("identifier", "type")
|
|
37
|
+
def validate_lower(cls, v: str) -> str:
|
|
38
|
+
return v.lower()
|
|
39
|
+
|
|
36
40
|
|
|
37
41
|
class IntegrationConfiguration(BaseOceanSettings, extra=Extra.allow):
|
|
38
42
|
initialize_port_resources: bool = True
|
|
@@ -8,13 +8,12 @@ from port_ocean.clients.port.client import PortClient
|
|
|
8
8
|
from port_ocean.clients.port.types import UserAgentType
|
|
9
9
|
from port_ocean.config.settings import IntegrationConfiguration
|
|
10
10
|
from port_ocean.context.ocean import ocean
|
|
11
|
+
from port_ocean.core.defaults.common import Defaults, get_port_integration_defaults
|
|
11
12
|
from port_ocean.core.handlers.port_app_config.models import PortAppConfig
|
|
12
13
|
from port_ocean.exceptions.port_defaults import (
|
|
13
14
|
AbortDefaultCreationError,
|
|
14
15
|
)
|
|
15
16
|
|
|
16
|
-
from port_ocean.core.defaults.common import Defaults, get_port_integration_defaults
|
|
17
|
-
|
|
18
17
|
|
|
19
18
|
def deconstruct_blueprints_to_creation_steps(
|
|
20
19
|
raw_blueprints: list[dict[str, Any]]
|
|
@@ -111,7 +110,7 @@ async def _create_resources(
|
|
|
111
110
|
)
|
|
112
111
|
)
|
|
113
112
|
|
|
114
|
-
await port_client.
|
|
113
|
+
await port_client.create_integration(
|
|
115
114
|
integration_config.integration.type,
|
|
116
115
|
integration_config.event_listener.to_request(),
|
|
117
116
|
port_app_config=defaults.port_app_config,
|
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,13 +41,13 @@ 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
|
|
50
|
-
port_ocean/config/settings.py,sha256=
|
|
50
|
+
port_ocean/config/settings.py,sha256=gKcc7q2HTu62JT-RyNXEZQ6TO7cafU6hXEN4Wd8DbBU,1366
|
|
51
51
|
port_ocean/consumers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
52
52
|
port_ocean/consumers/base_consumer.py,sha256=L0gW0DvUpeGVdb1RH83-wgbI37V6fsUKfd9Yox42-Gs,125
|
|
53
53
|
port_ocean/consumers/kafka_consumer.py,sha256=jFgL3Vnnqf0g6I843yLvo5vGBSdMKmmC7Q3WklCUFqY,3467
|
|
@@ -60,7 +60,7 @@ port_ocean/core/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
60
60
|
port_ocean/core/defaults/__init__.py,sha256=8qCZg8n06WAdMu9s_FiRtDYLGPGHbOuS60vapeUoAks,142
|
|
61
61
|
port_ocean/core/defaults/clean.py,sha256=qyrrPQ53JuH7SnbFrnsvvGvpBZgj8CA2fYpwJKkYRIg,2187
|
|
62
62
|
port_ocean/core/defaults/common.py,sha256=6o-14cglafhv4Kw7zihat154sgKyhPEXAQq4IQSNlhs,3470
|
|
63
|
-
port_ocean/core/defaults/initialize.py,sha256=
|
|
63
|
+
port_ocean/core/defaults/initialize.py,sha256=fvVFaYJWyGGlEbRz46Y48D3rRRLthJkstiQxYVam7WM,5248
|
|
64
64
|
port_ocean/core/event_listener/__init__.py,sha256=mzJ33wRq0kh60fpVdOHVmvMTUQIvz3vxmifyBgwDn0E,889
|
|
65
65
|
port_ocean/core/event_listener/base.py,sha256=cn-NJiw6x41h-I1DBpGDQr2NYmUwZKCUGeecwWL4stk,787
|
|
66
66
|
port_ocean/core/event_listener/factory.py,sha256=AYYfSHPAF7P5H-uQECXT0JVJjKDHrYkWJJBSL4mGkg8,3697
|
|
@@ -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
|