mirror of
https://github.com/nikdoof/python-ts3.git
synced 2025-12-17 11:59:27 +00:00
Fix data parsing from TS3 server
Problem happened when we tried to extend the data list from the dict, it just uses the keynames. Also if we have only one entry return the raw dict instead of a list
This commit is contained in:
10
ts3.py
10
ts3.py
@@ -66,13 +66,16 @@ class TS3Proto():
|
|||||||
resp = self._sockfile.readline()
|
resp = self._sockfile.readline()
|
||||||
resp = self.parse_command(resp)
|
resp = self.parse_command(resp)
|
||||||
if not 'command' in resp:
|
if not 'command' in resp:
|
||||||
data.extend(resp)
|
data.append(resp)
|
||||||
else:
|
else:
|
||||||
break
|
break
|
||||||
|
|
||||||
if resp['command'] == 'error':
|
if resp['command'] == 'error':
|
||||||
if data and resp['keys']['id'] == '0':
|
if data and resp['keys']['id'] == '0':
|
||||||
return data
|
if len(data) > 1:
|
||||||
|
return data
|
||||||
|
else:
|
||||||
|
return data[0]
|
||||||
else:
|
else:
|
||||||
return resp['keys']['id']
|
return resp['keys']['id']
|
||||||
|
|
||||||
@@ -90,8 +93,7 @@ class TS3Proto():
|
|||||||
@type opts: list
|
@type opts: list
|
||||||
"""
|
"""
|
||||||
|
|
||||||
cstr = []
|
cstr = [command]
|
||||||
cstr.append(command)
|
|
||||||
|
|
||||||
# Add the keys and values, escape as needed
|
# Add the keys and values, escape as needed
|
||||||
if keys:
|
if keys:
|
||||||
|
|||||||
Reference in New Issue
Block a user