diff options
Diffstat (limited to 'module/plugins/accounts/LinksnappyCom.py')
-rw-r--r-- | module/plugins/accounts/LinksnappyCom.py | 47 |
1 files changed, 26 insertions, 21 deletions
diff --git a/module/plugins/accounts/LinksnappyCom.py b/module/plugins/accounts/LinksnappyCom.py index 34571d374..00ae64b44 100644 --- a/module/plugins/accounts/LinksnappyCom.py +++ b/module/plugins/accounts/LinksnappyCom.py @@ -2,38 +2,42 @@ import hashlib -from module.plugins.Account import Account +from module.plugins.internal.Account import Account from module.common.json_layer import json_loads class LinksnappyCom(Account): __name__ = "LinksnappyCom" __type__ = "account" - __version__ = "0.05" + __version__ = "0.07" + __status__ = "testing" + __description__ = """Linksnappy.com account plugin""" __license__ = "GPLv3" __authors__ = [("stickell", "l.stickell@yahoo.it")] - def loadAccountInfo(self, user, req): - data = self.getAccountData(user) - r = req.load('http://gen.linksnappy.com/lseAPI.php', - get={'act': 'USERDETAILS', 'username': user, 'password': hashlib.md5(data['password']).hexdigest()}) + def parse_info(self, user, password, data, req): + data = self.get_data(user) + r = self.load('http://gen.linksnappy.com/lseAPI.php', + get={'act' : 'USERDETAILS', + 'username': user, + 'password': hashlib.md5(password).hexdigest()}) - self.logDebug("JSON data: " + r) + self.log_debug("JSON data: " + r) j = json_loads(r) if j['error']: - return {"premium": False} + return {'premium': False} validuntil = j['return']['expire'] - if validuntil == 'lifetime': + if validuntil == "lifetime": validuntil = -1 - elif validuntil == 'expired': - return {"premium": False} + elif validuntil == "expired": + return {'premium': False} else: validuntil = float(validuntil) @@ -41,17 +45,18 @@ class LinksnappyCom(Account): if 'trafficleft' not in j['return'] or isinstance(j['return']['trafficleft'], str): trafficleft = -1 else: - trafficleft = self.parseTraffic("%d MB" % j['return']['trafficleft']) + trafficleft = self.parse_traffic("%d MB" % j['return']['trafficleft']) - return {"premium": True, "validuntil": validuntil, "trafficleft": trafficleft} + return {'premium' : True , + 'validuntil' : validuntil , + 'trafficleft': trafficleft} - def login(self, user, data, req): - r = req.load("http://gen.linksnappy.com/lseAPI.php", - get={'act' : 'USERDETAILS', - 'username': user, - 'password': hashlib.md5(data['password']).hexdigest()}, - decode=True) + def login(self, user, password, data, req): + html = self.load("https://gen.linksnappy.com/lseAPI.php", + get={'act' : 'USERDETAILS', + 'username': user, + 'password': hashlib.md5(password).hexdigest()}) - if 'Invalid Account Details' in r: - self.wrongPassword() + if "Invalid Account Details" in html: + self.login_fail() |