From 97d25752691aa561c29a91166fdd30302bef2db2 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 21 Sep 2015 00:54:03 +0200 Subject: [Account] parse_info -> grab_info --- module/plugins/accounts/FreeWayMe.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/accounts/FreeWayMe.py') diff --git a/module/plugins/accounts/FreeWayMe.py b/module/plugins/accounts/FreeWayMe.py index 0c315873f..49e82ca54 100644 --- a/module/plugins/accounts/FreeWayMe.py +++ b/module/plugins/accounts/FreeWayMe.py @@ -15,7 +15,7 @@ class FreeWayMe(Account): __authors__ = [("Nicolas Giese", "james@free-way.me")] - def parse_info(self, user, password, data, req): + def grab_info(self, user, password, data, req): status = self.get_account_status(user, password, req) self.log_debug(status) @@ -38,7 +38,7 @@ class FreeWayMe(Account): #: Check if user and password are valid if not status: - self.login_fail() + self.fail_login() def get_account_status(self, user, password, req): @@ -48,6 +48,6 @@ class FreeWayMe(Account): self.log_debug("Login: %s" % answer) if answer == "Invalid login": - self.login_fail() + self.fail_login() return json_loads(answer) -- cgit v1.2.3 From fb45ec44220201268f99b747831df717fa7a83f8 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 21 Sep 2015 16:31:48 +0200 Subject: [Account] Fix __version__ --- module/plugins/accounts/FreeWayMe.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/accounts/FreeWayMe.py') diff --git a/module/plugins/accounts/FreeWayMe.py b/module/plugins/accounts/FreeWayMe.py index 49e82ca54..0cf80348a 100644 --- a/module/plugins/accounts/FreeWayMe.py +++ b/module/plugins/accounts/FreeWayMe.py @@ -7,7 +7,7 @@ from module.common.json_layer import json_loads class FreeWayMe(Account): __name__ = "FreeWayMe" __type__ = "account" - __version__ = "0.16" + __version__ = "0.17" __status__ = "testing" __description__ = """FreeWayMe account plugin""" -- cgit v1.2.3 From ec6e5dc7fcdcefee10e37d22473c9accae1104cf Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 29 Sep 2015 20:05:07 +0200 Subject: Account class completely rewritten + plugins updated --- module/plugins/accounts/FreeWayMe.py | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) (limited to 'module/plugins/accounts/FreeWayMe.py') diff --git a/module/plugins/accounts/FreeWayMe.py b/module/plugins/accounts/FreeWayMe.py index 0cf80348a..dc8027b3c 100644 --- a/module/plugins/accounts/FreeWayMe.py +++ b/module/plugins/accounts/FreeWayMe.py @@ -7,7 +7,7 @@ from module.common.json_layer import json_loads class FreeWayMe(Account): __name__ = "FreeWayMe" __type__ = "account" - __version__ = "0.17" + __version__ = "0.18" __status__ = "testing" __description__ = """FreeWayMe account plugin""" @@ -15,8 +15,16 @@ class FreeWayMe(Account): __authors__ = [("Nicolas Giese", "james@free-way.me")] - def grab_info(self, user, password, data, req): - status = self.get_account_status(user, password, req) + def grab_hosters(self, user, password, data): + hostis = self.load("http://www.free-way.bz/ajax/jd.php", + get={'id' : 3, + 'user': user, + 'pass': password}).replace("\"", "") #@TODO: Revert to `https` in 0.4.10 + return [x.strip() for x in hostis.split(",") if x.strip()] + + + def grab_info(self, user, password, data): + status = self.get_account_status(user, password) self.log_debug(status) @@ -33,15 +41,15 @@ class FreeWayMe(Account): return account_info - def login(self, user, password, data, req): - status = self.get_account_status(user, password, req) + def signin(self, user, password, data): + status = self.get_account_status(user, password) #: Check if user and password are valid if not status: self.fail_login() - def get_account_status(self, user, password, req): + def get_account_status(self, user, password): answer = self.load("http://www.free-way.bz/ajax/jd.php", #@TODO: Revert to `https` in 0.4.10 get={'id': 4, 'user': user, 'pass': password}) -- cgit v1.2.3 From 3b3a4bd889286777ba6a590a1f74cf3edae36a72 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 30 Sep 2015 00:30:53 +0200 Subject: Add __config__ to MultiAccount (and XFSAccount) based plugins --- module/plugins/accounts/FreeWayMe.py | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'module/plugins/accounts/FreeWayMe.py') diff --git a/module/plugins/accounts/FreeWayMe.py b/module/plugins/accounts/FreeWayMe.py index dc8027b3c..536280acc 100644 --- a/module/plugins/accounts/FreeWayMe.py +++ b/module/plugins/accounts/FreeWayMe.py @@ -10,6 +10,10 @@ class FreeWayMe(Account): __version__ = "0.18" __status__ = "testing" + __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"), + ("mh_list" , "str" , "Hoster list (comma separated)", "" ), + ("mh_interval", "int" , "Reload interval in minutes" , 60 )] + __description__ = """FreeWayMe account plugin""" __license__ = "GPLv3" __authors__ = [("Nicolas Giese", "james@free-way.me")] -- cgit v1.2.3 From 25d5726d4953b93a2e286fd6af8d4ead20670ba6 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 1 Oct 2015 04:55:17 +0200 Subject: A lot of plugin code cosmetics --- module/plugins/accounts/FreeWayMe.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'module/plugins/accounts/FreeWayMe.py') diff --git a/module/plugins/accounts/FreeWayMe.py b/module/plugins/accounts/FreeWayMe.py index 536280acc..b554f592a 100644 --- a/module/plugins/accounts/FreeWayMe.py +++ b/module/plugins/accounts/FreeWayMe.py @@ -20,11 +20,9 @@ class FreeWayMe(Account): def grab_hosters(self, user, password, data): - hostis = self.load("http://www.free-way.bz/ajax/jd.php", - get={'id' : 3, - 'user': user, - 'pass': password}).replace("\"", "") #@TODO: Revert to `https` in 0.4.10 - return [x.strip() for x in hostis.split(",") if x.strip()] + html = self.load("http://www.free-way.bz/ajax/jd.php", + get={'id' : 3, 'user': user, 'pass': password}) #@TODO: Revert to `https` in 0.4.10 + return [x for x in map(str.strip, html.replace("\"", "").split(",")) if x] def grab_info(self, user, password, data): -- cgit v1.2.3 From ab695d17397e101447102877cdd282d825051035 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 2 Oct 2015 04:22:19 +0200 Subject: [Account] Improve parse_traffic method + code cosmetics --- module/plugins/accounts/FreeWayMe.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/accounts/FreeWayMe.py') diff --git a/module/plugins/accounts/FreeWayMe.py b/module/plugins/accounts/FreeWayMe.py index b554f592a..5e214db35 100644 --- a/module/plugins/accounts/FreeWayMe.py +++ b/module/plugins/accounts/FreeWayMe.py @@ -7,7 +7,7 @@ from module.common.json_layer import json_loads class FreeWayMe(Account): __name__ = "FreeWayMe" __type__ = "account" - __version__ = "0.18" + __version__ = "0.19" __status__ = "testing" __config__ = [("mh_mode" , "all;listed;unlisted", "Filter hosters to use" , "all"), @@ -32,7 +32,7 @@ class FreeWayMe(Account): account_info = {'validuntil': -1, 'premium': False} if status['premium'] == "Free": - account_info['trafficleft'] = self.parse_traffic(status['guthaben'] + "MB") + account_info['trafficleft'] = self.parse_traffic(status['guthaben'], "MB") elif status['premium'] == "Spender": account_info['trafficleft'] = -1 elif status['premium'] == "Flatrate": -- cgit v1.2.3