@@ -28,8 +28,7 @@ def __init__(
2828 flush_interval : float = 10.0 ,
2929 timeout : float = 30.0 ,
3030 ) -> None :
31- """
32- Initialize the Aptabase client.
31+ """Initialize the Aptabase client.
3332
3433 Args:
3534 app_key: Your Aptabase app key (format: A-{REGION}-{ID})
@@ -63,7 +62,7 @@ def __init__(
6362 self ._event_queue : list [Event ] = []
6463 self ._queue_lock = asyncio .Lock ()
6564 self ._client : httpx .AsyncClient | None = None
66- self ._flush_task : asyncio .Task | None = None
65+ self ._flush_task : asyncio .Task [ Any ] | None = None
6766 self ._session_id : str | None = None
6867
6968 def _get_base_url (self , app_key : str ) -> str :
@@ -123,8 +122,7 @@ async def track(
123122 * ,
124123 session_id : str | None = None ,
125124 ) -> None :
126- """
127- Track an analytics event.
125+ """Track an analytics event.
128126
129127 Args:
130128 event_name: Name of the event to track
@@ -172,6 +170,8 @@ async def _flush_events(self) -> None:
172170
173171 async def _send_events (self , events : list [Event ]) -> None :
174172 """Send events to the Aptabase API."""
173+ assert self ._client is not None , "HTTP client is not initialized"
174+
175175 if not events :
176176 return
177177
0 commit comments