From 7b8c458cca7d21a029620f98e453f746fce69cd1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 14 Jul 2014 16:10:01 +0200 Subject: Prefer single quote for dict key name --- module/plugins/accounts/AlldebridCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/accounts/AlldebridCom.py') diff --git a/module/plugins/accounts/AlldebridCom.py b/module/plugins/accounts/AlldebridCom.py index acfb6874a..ee0a2ff28 100644 --- a/module/plugins/accounts/AlldebridCom.py +++ b/module/plugins/accounts/AlldebridCom.py @@ -33,7 +33,7 @@ class AlldebridCom(Account): except: data = self.getAccountData(user) page = req.load("http://www.alldebrid.com/api.php?action=info_user&login=%s&pw=%s" % (user, - data["password"])) + data['password'])) self.logDebug(page) xml = dom.parseString(page) exp_time = time() + int(xml.getElementsByTagName("date")[0].childNodes[0].nodeValue) * 24 * 60 * 60 @@ -41,7 +41,7 @@ class AlldebridCom(Account): return account_info def login(self, user, data, req): - urlparams = urllib.urlencode({'action': 'login', 'login_login': user, 'login_password': data["password"]}) + urlparams = urllib.urlencode({'action': 'login', 'login_login': user, 'login_password': data['password']}) page = req.load("http://www.alldebrid.com/register/?%s" % urlparams) if "This login doesn't exist" in page: -- cgit v1.2.3 From 8e47b0de30a25d0fd5dfb518bfe4e1e7beff93fd Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 15 Jul 2014 16:27:44 +0200 Subject: Key attributes cleanup for account, container and crypter plugins --- module/plugins/accounts/AlldebridCom.py | 2 ++ 1 file changed, 2 insertions(+) (limited to 'module/plugins/accounts/AlldebridCom.py') diff --git a/module/plugins/accounts/AlldebridCom.py b/module/plugins/accounts/AlldebridCom.py index ee0a2ff28..122d23447 100644 --- a/module/plugins/accounts/AlldebridCom.py +++ b/module/plugins/accounts/AlldebridCom.py @@ -13,10 +13,12 @@ class AlldebridCom(Account): __name__ = "AlldebridCom" __version__ = "0.22" __type__ = "account" + __description__ = """AllDebrid.com account plugin""" __author_name__ = "Andy Voigt" __author_mail__ = "spamsales@online.de" + def loadAccountInfo(self, user, req): data = self.getAccountData(user) page = req.load("http://www.alldebrid.com/account/") -- cgit v1.2.3 From ba916633f2bedb04c7358000b91aed69f52e8e43 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 1 Aug 2014 19:35:59 +0200 Subject: Remove trailing whitespaces + remove license headers + import urllib methods directly + sort and fix key attributes + use save_join instead join + sort some import declarations + other minor code cosmetics --- module/plugins/accounts/AlldebridCom.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'module/plugins/accounts/AlldebridCom.py') diff --git a/module/plugins/accounts/AlldebridCom.py b/module/plugins/accounts/AlldebridCom.py index 122d23447..dbf4ad800 100644 --- a/module/plugins/accounts/AlldebridCom.py +++ b/module/plugins/accounts/AlldebridCom.py @@ -1,18 +1,20 @@ # -*- coding: utf-8 -*- +import re import xml.dom.minidom as dom + from time import time -import re -import urllib +from urllib import urlencode -from module.plugins.Account import Account from BeautifulSoup import BeautifulSoup +from module.plugins.Account import Account + class AlldebridCom(Account): __name__ = "AlldebridCom" - __version__ = "0.22" __type__ = "account" + __version__ = "0.22" __description__ = """AllDebrid.com account plugin""" __author_name__ = "Andy Voigt" @@ -23,7 +25,7 @@ class AlldebridCom(Account): data = self.getAccountData(user) page = req.load("http://www.alldebrid.com/account/") soup = BeautifulSoup(page) - #Try to parse expiration date directly from the control panel page (better accuracy) + #Try to parse expiration date directly from the control panel page (better accuracy) try: time_text = soup.find('div', attrs={'class': 'remaining_time_text'}).strong.string self.logDebug("Account expires in: %s" % time_text) @@ -43,7 +45,7 @@ class AlldebridCom(Account): return account_info def login(self, user, data, req): - urlparams = urllib.urlencode({'action': 'login', 'login_login': user, 'login_password': data['password']}) + urlparams = urlencode({'action': 'login', 'login_login': user, 'login_password': data['password']}) page = req.load("http://www.alldebrid.com/register/?%s" % urlparams) if "This login doesn't exist" in page: -- cgit v1.2.3 From b0868ae6446078bacf1635dde5e4ab316b4a94cb Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 7 Oct 2014 18:57:59 +0200 Subject: New __authors__ key replaces __author_name__ and __author_mail__ + Whitespaces and EOF fixup --- module/plugins/accounts/AlldebridCom.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'module/plugins/accounts/AlldebridCom.py') diff --git a/module/plugins/accounts/AlldebridCom.py b/module/plugins/accounts/AlldebridCom.py index dbf4ad800..06469847e 100644 --- a/module/plugins/accounts/AlldebridCom.py +++ b/module/plugins/accounts/AlldebridCom.py @@ -17,8 +17,7 @@ class AlldebridCom(Account): __version__ = "0.22" __description__ = """AllDebrid.com account plugin""" - __author_name__ = "Andy Voigt" - __author_mail__ = "spamsales@online.de" + __authors__ = [("Andy Voigt", "spamsales@online.de")] def loadAccountInfo(self, user, req): -- cgit v1.2.3 From ae7a7e66981456e5bbe2b54006d79b6f907be7a4 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 8 Oct 2014 20:18:13 +0200 Subject: Add __license__ key attribute to plugins --- module/plugins/accounts/AlldebridCom.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/accounts/AlldebridCom.py') diff --git a/module/plugins/accounts/AlldebridCom.py b/module/plugins/accounts/AlldebridCom.py index 06469847e..3ebdae629 100644 --- a/module/plugins/accounts/AlldebridCom.py +++ b/module/plugins/accounts/AlldebridCom.py @@ -17,6 +17,7 @@ class AlldebridCom(Account): __version__ = "0.22" __description__ = """AllDebrid.com account plugin""" + __license__ = "GPLv3" __authors__ = [("Andy Voigt", "spamsales@online.de")] -- cgit v1.2.3 From 6a0fb7fdd4ea2749be44625225d8a235a78f032f Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 11 Oct 2014 15:42:39 +0200 Subject: [accounts] Code cosmetics --- module/plugins/accounts/AlldebridCom.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/accounts/AlldebridCom.py') diff --git a/module/plugins/accounts/AlldebridCom.py b/module/plugins/accounts/AlldebridCom.py index 3ebdae629..842d4c060 100644 --- a/module/plugins/accounts/AlldebridCom.py +++ b/module/plugins/accounts/AlldebridCom.py @@ -44,6 +44,7 @@ class AlldebridCom(Account): account_info = {"validuntil": exp_time, "trafficleft": -1} return account_info + def login(self, user, data, req): urlparams = urlencode({'action': 'login', 'login_login': user, 'login_password': data['password']}) page = req.load("http://www.alldebrid.com/register/?%s" % urlparams) -- cgit v1.2.3 From 34984dae733c3f3d47b41a0acfba3724d53c65a1 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 28 Oct 2014 16:52:10 +0100 Subject: Code cosmetics: plugin class attributes --- module/plugins/accounts/AlldebridCom.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/accounts/AlldebridCom.py') diff --git a/module/plugins/accounts/AlldebridCom.py b/module/plugins/accounts/AlldebridCom.py index 842d4c060..344b54e4f 100644 --- a/module/plugins/accounts/AlldebridCom.py +++ b/module/plugins/accounts/AlldebridCom.py @@ -12,13 +12,13 @@ from module.plugins.Account import Account class AlldebridCom(Account): - __name__ = "AlldebridCom" - __type__ = "account" + __name__ = "AlldebridCom" + __type__ = "account" __version__ = "0.22" __description__ = """AllDebrid.com account plugin""" - __license__ = "GPLv3" - __authors__ = [("Andy Voigt", "spamsales@online.de")] + __license__ = "GPLv3" + __authors__ = [("Andy Voigt", "spamsales@online.de")] def loadAccountInfo(self, user, req): -- cgit v1.2.3 From 67587fbe0335cacfde28a86ba729b9d567ce1da7 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 7 Dec 2014 00:27:18 +0100 Subject: Plugin code cosmetics (3) --- module/plugins/accounts/AlldebridCom.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/accounts/AlldebridCom.py') diff --git a/module/plugins/accounts/AlldebridCom.py b/module/plugins/accounts/AlldebridCom.py index 344b54e4f..1fb5e4b54 100644 --- a/module/plugins/accounts/AlldebridCom.py +++ b/module/plugins/accounts/AlldebridCom.py @@ -36,8 +36,8 @@ class AlldebridCom(Account): #Get expiration date from API except: data = self.getAccountData(user) - page = req.load("http://www.alldebrid.com/api.php?action=info_user&login=%s&pw=%s" % (user, - data['password'])) + page = req.load("http://www.alldebrid.com/api.php", + get={'action': "info_user", 'login': user, 'pw': data['password']}) self.logDebug(page) xml = dom.parseString(page) exp_time = time() + int(xml.getElementsByTagName("date")[0].childNodes[0].nodeValue) * 24 * 60 * 60 -- cgit v1.2.3 From fb65d5354c3cc80c3f48c3a2745b8dc01105edfd Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 18 Dec 2014 16:02:29 +0100 Subject: Update account plugins --- module/plugins/accounts/AlldebridCom.py | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'module/plugins/accounts/AlldebridCom.py') diff --git a/module/plugins/accounts/AlldebridCom.py b/module/plugins/accounts/AlldebridCom.py index 1fb5e4b54..8fb841a39 100644 --- a/module/plugins/accounts/AlldebridCom.py +++ b/module/plugins/accounts/AlldebridCom.py @@ -23,8 +23,8 @@ class AlldebridCom(Account): def loadAccountInfo(self, user, req): data = self.getAccountData(user) - page = req.load("http://www.alldebrid.com/account/") - soup = BeautifulSoup(page) + html = req.load("http://www.alldebrid.com/account/") + soup = BeautifulSoup(html) #Try to parse expiration date directly from the control panel page (better accuracy) try: time_text = soup.find('div', attrs={'class': 'remaining_time_text'}).strong.string @@ -36,10 +36,10 @@ class AlldebridCom(Account): #Get expiration date from API except: data = self.getAccountData(user) - page = req.load("http://www.alldebrid.com/api.php", + html = req.load("http://www.alldebrid.com/api.php", get={'action': "info_user", 'login': user, 'pw': data['password']}) - self.logDebug(page) - xml = dom.parseString(page) + self.logDebug(html) + xml = dom.parseString(html) exp_time = time() + int(xml.getElementsByTagName("date")[0].childNodes[0].nodeValue) * 24 * 60 * 60 account_info = {"validuntil": exp_time, "trafficleft": -1} return account_info @@ -47,13 +47,13 @@ class AlldebridCom(Account): def login(self, user, data, req): urlparams = urlencode({'action': 'login', 'login_login': user, 'login_password': data['password']}) - page = req.load("http://www.alldebrid.com/register/?%s" % urlparams) + html = req.load("http://www.alldebrid.com/register/?%s" % urlparams) - if "This login doesn't exist" in page: + if "This login doesn't exist" in html: self.wrongPassword() - if "The password is not valid" in page: + if "The password is not valid" in html: self.wrongPassword() - if "Invalid captcha" in page: + if "Invalid captcha" in html: self.wrongPassword() -- cgit v1.2.3 From 522b3b5cb04ae74cd441b3c1a32512e8576da357 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 30 Dec 2014 02:12:47 +0100 Subject: [AlldebridCom] Code cosmetics --- module/plugins/accounts/AlldebridCom.py | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) (limited to 'module/plugins/accounts/AlldebridCom.py') diff --git a/module/plugins/accounts/AlldebridCom.py b/module/plugins/accounts/AlldebridCom.py index 8fb841a39..278f3af06 100644 --- a/module/plugins/accounts/AlldebridCom.py +++ b/module/plugins/accounts/AlldebridCom.py @@ -4,7 +4,6 @@ import re import xml.dom.minidom as dom from time import time -from urllib import urlencode from BeautifulSoup import BeautifulSoup @@ -25,35 +24,40 @@ class AlldebridCom(Account): data = self.getAccountData(user) html = req.load("http://www.alldebrid.com/account/") soup = BeautifulSoup(html) + #Try to parse expiration date directly from the control panel page (better accuracy) try: time_text = soup.find('div', attrs={'class': 'remaining_time_text'}).strong.string + self.logDebug("Account expires in: %s" % time_text) + p = re.compile('\d+') exp_data = p.findall(time_text) exp_time = time() + int(exp_data[0]) * 24 * 60 * 60 + int( exp_data[1]) * 60 * 60 + (int(exp_data[2]) - 1) * 60 + #Get expiration date from API except: data = self.getAccountData(user) html = req.load("http://www.alldebrid.com/api.php", get={'action': "info_user", 'login': user, 'pw': data['password']}) + self.logDebug(html) + xml = dom.parseString(html) exp_time = time() + int(xml.getElementsByTagName("date")[0].childNodes[0].nodeValue) * 24 * 60 * 60 + account_info = {"validuntil": exp_time, "trafficleft": -1} return account_info def login(self, user, data, req): - urlparams = urlencode({'action': 'login', 'login_login': user, 'login_password': data['password']}) - html = req.load("http://www.alldebrid.com/register/?%s" % urlparams) - - if "This login doesn't exist" in html: - self.wrongPassword() - - if "The password is not valid" in html: - self.wrongPassword() - - if "Invalid captcha" in html: + html = req.load("http://www.alldebrid.com/register/", + get={'action' : "login", + 'login_login' : user, + 'login_password': data['password']}) + + if "This login doesn't exist" in html \ + or "The password is not valid" in html \ + or "Invalid captcha" in html: self.wrongPassword() -- cgit v1.2.3