Skip to content

Commit

Permalink
moved the http client to more accessible for integrations (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
yairsimantov20 authored Aug 9, 2023
1 parent bf0c21b commit 5f2d466
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions changelog/improvement.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Moved the ocean httpx client so it will be more accessible to integrations
2 changes: 1 addition & 1 deletion port_ocean/clients/port/authentication.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from pydantic import BaseModel, Field, PrivateAttr

from port_ocean.clients.port.types import UserAgentType
from port_ocean.clients.port.utils import handle_status_code
from port_ocean.clients.utils import handle_status_code
from port_ocean.utils import get_time


Expand Down
4 changes: 2 additions & 2 deletions port_ocean/clients/port/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
from port_ocean.clients.port.types import (
KafkaCreds,
)
from port_ocean.clients.port.utils import handle_status_code, http
from port_ocean.clients.utils import handle_status_code, async_client
from port_ocean.exceptions.clients import KafkaCredentialsNotFound


Expand All @@ -21,7 +21,7 @@ def __init__(
integration_type: str,
):
self.api_url = f"{base_url}/v1"
self.client = http
self.client = async_client
self.auth = PortAuthentication(
self.client,
client_id,
Expand Down
2 changes: 1 addition & 1 deletion port_ocean/clients/port/mixins/blueprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from loguru import logger

from port_ocean.clients.port.authentication import PortAuthentication
from port_ocean.clients.port.utils import handle_status_code
from port_ocean.clients.utils import handle_status_code
from port_ocean.core.models import Blueprint


Expand Down
2 changes: 1 addition & 1 deletion port_ocean/clients/port/mixins/entities.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

from port_ocean.clients.port.authentication import PortAuthentication
from port_ocean.clients.port.types import RequestOptions, UserAgentType
from port_ocean.clients.port.utils import handle_status_code
from port_ocean.clients.utils import handle_status_code
from port_ocean.core.models import Entity


Expand Down
2 changes: 1 addition & 1 deletion port_ocean/clients/port/mixins/integrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from starlette import status

from port_ocean.clients.port.authentication import PortAuthentication
from port_ocean.clients.port.utils import handle_status_code
from port_ocean.clients.utils import handle_status_code

if TYPE_CHECKING:
from port_ocean.core.handlers.port_app_config.models import PortAppConfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def _get_http_client_context() -> httpx.AsyncClient:
return client


http: httpx.AsyncClient = LocalProxy(lambda: _get_http_client_context()) # type: ignore
async_client: httpx.AsyncClient = LocalProxy(lambda: _get_http_client_context()) # type: ignore


def handle_status_code(
Expand Down

0 comments on commit 5f2d466

Please sign in to comment.