mirror of
https://github.com/nikdoof/python-ts3.git
synced 2025-12-17 11:59:27 +00:00
return response data always as a list for
This commit is contained in:
12
ts3.py
12
ts3.py
@@ -57,13 +57,15 @@ class TS3Response():
|
||||
def __init__(self, response, data):
|
||||
self.response = TS3Proto.parse_command(response)
|
||||
self.data = TS3Proto.parse_command(data)
|
||||
|
||||
if isinstance(self.data, dict):
|
||||
if self.data:
|
||||
self.data = [self.data]
|
||||
else:
|
||||
self.data = []
|
||||
|
||||
def is_successful(self):
|
||||
if isinstance(self.response, dict):
|
||||
return self.response['keys']['msg'] == 'ok'
|
||||
|
||||
# if the response is a list, it has to be successful
|
||||
return True
|
||||
return self.response['keys']['msg'] == 'ok'
|
||||
|
||||
class TS3Proto():
|
||||
def connect(self, ip, port, timeout=5):
|
||||
|
||||
Reference in New Issue
Block a user