mirror of
https://github.com/onyx-and-iris/obsws-python.git
synced 2024-11-22 12:50:53 +00:00
alter format of __repr__ in Req + Event clients
password now defaults to empty string, not None.
This commit is contained in:
parent
cc9b1e2c72
commit
48e90c82fb
@ -26,7 +26,7 @@ By default the clients connect with parameters:
|
|||||||
|
|
||||||
- `host`: "localhost"
|
- `host`: "localhost"
|
||||||
- `port`: 4455
|
- `port`: 4455
|
||||||
- `password`: None
|
- `password`: ""
|
||||||
|
|
||||||
You may override these parameters by storing them in a toml config file or passing them as keyword arguments.
|
You may override these parameters by storing them in a toml config file or passing them as keyword arguments.
|
||||||
|
|
||||||
|
@ -14,7 +14,7 @@ class ObsClient:
|
|||||||
logger = logging.getLogger("baseclient.obsclient")
|
logger = logging.getLogger("baseclient.obsclient")
|
||||||
|
|
||||||
def __init__(self, **kwargs):
|
def __init__(self, **kwargs):
|
||||||
defaultkwargs = {"host": "localhost", "port": 4455, "password": None, "subs": 0}
|
defaultkwargs = {"host": "localhost", "port": 4455, "password": "", "subs": 0}
|
||||||
if not any(key in kwargs for key in ("host", "port", "password")):
|
if not any(key in kwargs for key in ("host", "port", "password")):
|
||||||
kwargs |= self._conn_from_toml()
|
kwargs |= self._conn_from_toml()
|
||||||
kwargs = defaultkwargs | kwargs
|
kwargs = defaultkwargs | kwargs
|
||||||
@ -22,7 +22,7 @@ class ObsClient:
|
|||||||
setattr(self, attr, val)
|
setattr(self, attr, val)
|
||||||
|
|
||||||
self.logger.info(
|
self.logger.info(
|
||||||
"Connecting with parameters: {host} {port} {password} {subs}".format(
|
"Connecting with parameters: host='{host}' port={port} password='{password}' subs={subs}".format(
|
||||||
**self.__dict__
|
**self.__dict__
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -28,8 +28,10 @@ class EventClient:
|
|||||||
self.subscribe()
|
self.subscribe()
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return type(self).__name__ + "({host} {port} {password} {subs})".format(
|
return type(
|
||||||
**self.base_client.__dict__
|
self
|
||||||
|
).__name__ + "(host='{host}', port={port}, password='{password}', subs={subs})".format(
|
||||||
|
**self.base_client.__dict__,
|
||||||
)
|
)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
@ -26,8 +26,10 @@ class ReqClient:
|
|||||||
self.base_client.ws.close()
|
self.base_client.ws.close()
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return type(self).__name__ + "({host} {port} {password})".format(
|
return type(
|
||||||
**self.base_client.__dict__
|
self
|
||||||
|
).__name__ + "(host='{host}', port={port}, password='{password}')".format(
|
||||||
|
**self.base_client.__dict__,
|
||||||
)
|
)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
|
Loading…
Reference in New Issue
Block a user