Skip to content
8 changes: 5 additions & 3 deletions src/shade/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@

from .config import Environment, validate_client_settings
from .config import config as _config
from .http import AsyncHTTPClient, HTTPXTransport, SyncHTTPClient
from .http import AsyncHTTPClient, HTTPXTransport
from .http_client import _SyncHTTPClient

API_KEY_ENV_VAR = "SHADE_API_KEY"
ENVIRONMENT_ENV_VAR = "SHADE_ENVIRONMENT"
Expand Down Expand Up @@ -97,8 +98,8 @@ def __init__(
max_retries if max_retries is not None else _config.max_retries,
)

self._http = SyncHTTPClient(
base_url=self._api_base,
self._http = _SyncHTTPClient(
api_base=self._api_base,
api_key=self._api_key,
environment=self._environment,
max_retries=self._max_retries,
Expand Down Expand Up @@ -192,6 +193,7 @@ def api_base(self) -> str:
return self._base_url

def close(self) -> None:
self._http.close()
self._client.close()

def __enter__(self) -> "ShadeClient":
Expand Down
5 changes: 2 additions & 3 deletions src/shade/gateway.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ def process_payment(self, amount: float, currency: str) -> Dict[str, Any]:
dict
API response body.
"""
return self._http.request(
"POST",
return self._http.post(
"/payments",
{"amount": amount, "currency": currency},
json={"amount": amount, "currency": currency},
)

async def process_payment_async(
Expand Down
Loading
Loading