Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion google/genai/_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2101,7 +2101,9 @@ async def aclose(self) -> None:
"""Closes the API async client."""
# Let users close the custom client explicitly by themselves. Otherwise,
# close the client when the object is garbage collected.
if not self._http_options.httpx_async_client:
if not self._http_options.httpx_async_client and getattr(
self, '_async_httpx_client', None
):
await self._async_httpx_client.aclose() # type: ignore[union-attr]
if self._aiohttp_session and not self._http_options.aiohttp_client:
await self._aiohttp_session.close()
Expand Down
Loading