Skip to content

Commit 3def739

Browse files
authored
Merge pull request #148 from LewisJassy/feature/AsynMpesaClient
Enhance M-PESA SDK with Async Support
2 parents bbfa2a2 + a6776c3 commit 3def739

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

mpesakit/mpesa_client.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,3 +292,14 @@ def __init__(
292292
self.ratiba = AsyncRatibaService(
293293
http_client=self.http_client, token_manager=self.token_manager
294294
)
295+
296+
async def __aenter__(self):
297+
await self.http_client.__aenter__()
298+
return self
299+
300+
async def __aexit__(self, exc_type, exc_val, exc_tb):
301+
await self.http_client.__aexit__(exc_type, exc_val, exc_tb)
302+
303+
async def aclose(self) -> None:
304+
"""Close the underlying HTTP client connection pool."""
305+
await self.http_client.aclose()

0 commit comments

Comments
 (0)