Summary
The async client exposes aclose / __aenter__ / __aexit__ and closes its httpx client, but the sync API never exposes close() / __enter__ / __exit__ and never closes the underlying requests.Session. The session and its connection pool live until GC — an asymmetry with the async side and a resource leak in long-lived processes.
Location
datamaxi/api.py:73 (session created; never closed)
Fix
Add to API (and surface through Resource / Datamaxi):
def close(self):
self.session.close()
def __enter__(self):
return self
def __exit__(self, *exc):
self.close()
So users can do with Datamaxi(...) as client: ..., mirroring async with AsyncDatamaxi(...).
Surfaced during a pythonic-idiom review of the SDK.
Summary
The async client exposes
aclose/__aenter__/__aexit__and closes its httpx client, but the syncAPInever exposesclose()/__enter__/__exit__and never closes the underlyingrequests.Session. The session and its connection pool live until GC — an asymmetry with the async side and a resource leak in long-lived processes.Location
datamaxi/api.py:73(session created; never closed)Fix
Add to
API(and surface throughResource/Datamaxi):So users can do
with Datamaxi(...) as client: ..., mirroringasync with AsyncDatamaxi(...).Surfaced during a pythonic-idiom review of the SDK.