From 44610f12bd3fbd39f49035d959833ff9c8f49170 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Mon, 6 Jun 2011 08:22:24 +0100 Subject: [PATCH] Make is_successful a property, gm/use now return boolean responses --- ts3.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ts3.py b/ts3.py index 7d5cdae..964248b 100644 --- a/ts3.py +++ b/ts3.py @@ -69,6 +69,7 @@ class TS3Response(): else: self.data = [] + @property def is_successful(self): return self.response['keys']['msg'] == 'ok' @@ -257,7 +258,7 @@ class TS3Server(TS3Proto): """ response = self.send_command('login', keys={'client_login_name': username, 'client_login_password': password }) - return response.is_successful() + return response.is_successful def serverlist(self): """ @@ -272,7 +273,8 @@ class TS3Server(TS3Proto): @param msg: Message @type ip: str """ - return self.send_command('gm', keys={'msg': msg}) + response = self.send_command('gm', keys={'msg': msg}) + return response.is_successful def use(self, id): """ @@ -281,4 +283,5 @@ class TS3Server(TS3Proto): @param id: Virtual Server ID @type id: int """ - self.send_command('use', keys={'sid': id}) + response = self.send_command('use', keys={'sid': id}) + return response.is_successful