summaryrefslogtreecommitdiffstats
path: root/module/plugins/accounts/AlldebridCom.py
diff options
context:
space:
mode:
authorGravatar Stefano <l.stickell@yahoo.it> 2013-07-23 20:22:42 +0200
committerGravatar Stefano <l.stickell@yahoo.it> 2013-07-23 20:22:42 +0200
commitf5535809bebc6cc343475704832c8fd8674d2d06 (patch)
treec59bc1e6d71c04f5545ea262056c0c5be1bd8910 /module/plugins/accounts/AlldebridCom.py
parentFixed PEP 8 violations in Hosters (diff)
downloadpyload-f5535809bebc6cc343475704832c8fd8674d2d06.tar.xz
Fixed PEP 8 violations in Accounts
Diffstat (limited to 'module/plugins/accounts/AlldebridCom.py')
-rw-r--r--module/plugins/accounts/AlldebridCom.py31
1 files changed, 17 insertions, 14 deletions
diff --git a/module/plugins/accounts/AlldebridCom.py b/module/plugins/accounts/AlldebridCom.py
index baaa9d264..9fb050535 100644
--- a/module/plugins/accounts/AlldebridCom.py
+++ b/module/plugins/accounts/AlldebridCom.py
@@ -1,10 +1,12 @@
-from module.plugins.Account import Account
import xml.dom.minidom as dom
-from BeautifulSoup import BeautifulSoup
from time import time
import re
import urllib
+from module.plugins.Account import Account
+from BeautifulSoup import BeautifulSoup
+
+
class AlldebridCom(Account):
__name__ = "AlldebridCom"
__version__ = "0.21"
@@ -16,34 +18,35 @@ class AlldebridCom(Account):
def loadAccountInfo(self, user, req):
data = self.getAccountData(user)
page = req.load("http://www.alldebrid.com/account/")
- soup=BeautifulSoup(page)
+ soup = BeautifulSoup(page)
#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
+ time_text = soup.find('div', attrs={'class': 'remaining_time_text'}).strong.string
self.log.debug("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
+ 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)
- 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?action=info_user&login=%s&pw=%s" % (user,
+ data["password"]))
self.log.debug(page)
xml = dom.parseString(page)
- exp_time=time()+int(xml.getElementsByTagName("date")[0].childNodes[0].nodeValue)*86400
+ exp_time = time() + int(xml.getElementsByTagName("date")[0].childNodes[0].nodeValue) * 86400
account_info = {"validuntil": exp_time, "trafficleft": -1}
return account_info
- def login(self, user, data, req):
-
- urlparams = urllib.urlencode({'action':'login','login_login':user,'login_password':data["password"]})
- page = req.load("http://www.alldebrid.com/register/?%s" % (urlparams))
+ def login(self, user, data, req):
+ 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:
self.wrongPassword()
-
+
if "The password is not valid" in page:
self.wrongPassword()
-
+
if "Invalid captcha" in page:
self.wrongPassword()