Skip to content

Add public close() to release the HTTP client - #29

Open
townsmcp wants to merge 2 commits into
SAIC-iSmart-API:masterfrom
townsmcp:add-close-method
Open

Add public close() to release the HTTP client#29
townsmcp wants to merge 2 commits into
SAIC-iSmart-API:masterfrom
townsmcp:add-close-method

Conversation

@townsmcp

Copy link
Copy Markdown

Closes #28.

SaicApiClient owns an httpx.AsyncClient that previously had no public
means of being closed, so consumers couldn't release the transport after
use or after a failed login — it leaked until GC/process exit. This adds:

  • SaicApiClient.close() — calls aclose() on the underlying
    httpx.AsyncClient.
  • AbstractSaicApi.close() — delegates to the client's close().

The change is additive and backward-compatible; no existing behaviour is
altered. Verified that after await api.close() the underlying client's
is_closed is True.

Downstream context: the mg-saic-ha Home Assistant integration currently
reaches the private httpx client to close it as a workaround; once this
ships, it can use the public method instead.

townsmcp added 2 commits July 19, 2026 11:00
Added a close method to release HTTP client connections.
Added a close method to the API client for resource management.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add a public method to close the underlying httpx.AsyncClient

1 participant