mirror of
https://github.com/onyx-and-iris/obsws-python.git
synced 2026-04-18 05:53:32 +00:00
only check for host+port values in init.
only pass auth token if auth enabled add context manager methods to reqclient. added logging
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import logging
|
||||
|
||||
from .baseclient import ObsClient
|
||||
from .error import OBSSDKError
|
||||
from .util import as_dataclass
|
||||
@@ -10,9 +12,18 @@ https://github.com/obsproject/obs-websocket/blob/master/docs/generated/protocol.
|
||||
|
||||
|
||||
class ReqClient:
|
||||
logger = logging.getLogger("reqs.reqclient")
|
||||
|
||||
def __init__(self, **kwargs):
|
||||
self.base_client = ObsClient(**kwargs)
|
||||
self.base_client.authenticate()
|
||||
if self.base_client.authenticate():
|
||||
self.logger.info("Successfully identified client with the server")
|
||||
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
def __exit__(self, exc_type, exc_value, exc_traceback):
|
||||
self.base_client.ws.close()
|
||||
|
||||
def send(self, param, data=None):
|
||||
response = self.base_client.req(param, data)
|
||||
@@ -486,7 +497,7 @@ class ReqClient:
|
||||
|
||||
|
||||
"""
|
||||
return self.send("GetSceneList")
|
||||
return self.send("GetGroupList")
|
||||
|
||||
def get_current_program_scene(self):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user