pshell_client: added some further ifnoramtion for auto docs

This commit is contained in:
2026-02-18 10:56:39 +01:00
parent 4f84eb67f2
commit b19b8d37b2
+8
View File
@@ -12,6 +12,7 @@ except ImportError:
class TimeoutException(Exception):
"""Timeout Exception raised by wait methods when a requested state or evenet doesn't arrive in time"""
pass
@@ -21,6 +22,9 @@ except:
SSEClient = None
class SSEReceiver:
"""Background thread that parses incoming SSE (serveer-sent events) via an event thread and dispatches them to subscribers
:param url
:param subscribed_events"""
def __init__(self, url, subscribed_events):
if SSEClient is None:
raise Exception("sseclient library is not installed: server events are not available")
@@ -37,6 +41,7 @@ class SSEReceiver:
self.thread.start()
def task(self):
"""SSE event loop task"""
try:
while not self._stop.is_set():
try:
@@ -164,15 +169,18 @@ class SSEReceiver:
pass
def close(self):
"""Close SSE client - stops the thread and closes resources"""
self._stop.set()
self._close_client()
if self.debug:
print("closed")
def is_closed(self):
"""Return True if SSE client is closed"""
return self._stop.is_set()
class PShellClient:
"""High-level REST API wrapper for the P-Shell service"""
def __init__(self, url):
if not url.endswith('/'):
url = url + "/"