Skip to content

Add a public method to close the underlying httpx.AsyncClient #28

Description

@townsmcp

SaicApiClient creates and owns an httpx.AsyncClient, but neither it nor AbstractSaicApi exposes a way to close it. A consumer that constructs a SaicApi, experiences a failed login (or simply finishes using the client), and then tries to clean up has no supported way to release the transport — so the underlying HTTP client stays open until garbage collection or process exit. Under repeated failed logins this leaks connections.
Would you accept a small, additive PR adding async def close() to both SaicApiClient (closing its httpx.AsyncClient via aclose()) and AbstractSaicApi (delegating to the client)? It's backward-compatible — nothing existing changes. Happy to open it. Context: this came up in the mg-saic-ha Home Assistant integration, which currently has to reach the private client to close it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions