Skip to content

Commit

Permalink
rename to _prepare_api_call_kwargs_async
Browse files Browse the repository at this point in the history
  • Loading branch information
JeremyDOwens committed Dec 11, 2024
1 parent 92e799d commit cf77beb
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions fivetran_provider_async/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -634,15 +634,10 @@ class FivetranHookAsync(FivetranHook):
def __init__(self, *args, **kwargs) -> None:
super().__init__(*args, **kwargs)

def _prepare_api_call_kwargs(self, method: str, endpoint: str, **kwargs: Any) -> dict[str, Any]:
# Cache existing auth and remove from kwargs dict.
prior_auth = kwargs.pop("auth", None)

kwargs = super()._prepare_api_call_kwargs(method, endpoint, **kwargs)
def _prepare_api_call_kwargs_async(self, method: str, endpoint: str, **kwargs: Any) -> dict[str, Any]:
kwargs = self._prepare_api_call_kwargs(method, endpoint, **kwargs)
auth = kwargs.get("auth")
if prior_auth is not None and isinstance(prior_auth, aiohttp.BasicAuth):
kwargs["auth"] = prior_auth
elif auth is not None and is_container(auth) and 2 <= len(auth) <= 3:
if auth is not None and is_container(auth) and 2 <= len(auth) <= 3:
kwargs["auth"] = aiohttp.BasicAuth(*auth)
return kwargs

Expand Down Expand Up @@ -671,7 +666,7 @@ async def _do_api_call_async(

url = f"{self.api_protocol}://{self.api_host}/{endpoint}"

kwargs = self._prepare_api_call_kwargs(method, endpoint, **kwargs)
kwargs = self._prepare_api_call_kwargs_async(method, endpoint, **kwargs)

async with aiohttp.ClientSession() as session:
attempt_num = 1
Expand Down

0 comments on commit cf77beb

Please sign in to comment.