update refactoring and add new features
This commit is contained in:
+2
-6
@@ -1,6 +1,7 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Dict, Optional
|
||||
import atexit
|
||||
import threading
|
||||
|
||||
from .HTTP import HTTPClient
|
||||
@@ -19,6 +20,7 @@ class API:
|
||||
self.timeout = float(timeout)
|
||||
self._http_client: Optional[HTTPClient] = None
|
||||
self._http_client_lock = threading.Lock()
|
||||
atexit.register(self.close)
|
||||
|
||||
def _get_http_client(self) -> HTTPClient:
|
||||
"""Return a reusable opened HTTP client for this API instance."""
|
||||
@@ -49,12 +51,6 @@ class API:
|
||||
pass
|
||||
self._http_client = None
|
||||
|
||||
def __del__(self) -> None:
|
||||
try:
|
||||
self.close()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def _get_json(
|
||||
self,
|
||||
path: str,
|
||||
|
||||
+1
-1
@@ -69,7 +69,7 @@ def run_cmdlet(
|
||||
) -> CmdletRunResult:
|
||||
"""Run a single cmdlet programmatically and return structured results.
|
||||
|
||||
This is intended for TUI/webapp consumers that want cmdlet behavior without
|
||||
This is intended for programmatic consumers that want cmdlet behavior without
|
||||
going through the interactive CLI loop.
|
||||
|
||||
Notes:
|
||||
|
||||
Reference in New Issue
Block a user