From f5535809bebc6cc343475704832c8fd8674d2d06 Mon Sep 17 00:00:00 2001 From: Stefano Date: Tue, 23 Jul 2013 20:22:42 +0200 Subject: Fixed PEP 8 violations in Accounts --- module/plugins/accounts/AlldebridCom.py | 31 +++++++++++--------- module/plugins/accounts/BayfilesCom.py | 16 +++++------ module/plugins/accounts/BitshareCom.py | 9 +++--- module/plugins/accounts/BoltsharingCom.py | 1 + module/plugins/accounts/CramitIn.py | 5 ++-- module/plugins/accounts/CyberlockerCh.py | 5 ++-- module/plugins/accounts/DdlstorageCom.py | 5 ++-- module/plugins/accounts/DebridItaliaCom.py | 1 - module/plugins/accounts/DepositfilesCom.py | 15 +++++----- module/plugins/accounts/EasybytezCom.py | 36 ++++++++++++----------- module/plugins/accounts/EgoFilesCom.py | 4 ++- module/plugins/accounts/EuroshareEu.py | 25 ++++++++-------- module/plugins/accounts/FilebeerInfo.py | 22 +++++++-------- module/plugins/accounts/FilecloudIo.py | 22 +++++++-------- module/plugins/accounts/FilefactoryCom.py | 18 ++++++------ module/plugins/accounts/FilejungleCom.py | 20 +++++++------ module/plugins/accounts/FilerNet.py | 1 - module/plugins/accounts/FilerioCom.py | 5 ++-- module/plugins/accounts/FilesMailRu.py | 13 +++++---- module/plugins/accounts/FileserveCom.py | 2 +- module/plugins/accounts/FourSharedCom.py | 25 ++++++++-------- module/plugins/accounts/FreakshareCom.py | 4 ++- module/plugins/accounts/FshareVn.py | 19 +++++++------ module/plugins/accounts/Ftp.py | 5 ++-- module/plugins/accounts/HellshareCz.py | 18 ++++++------ module/plugins/accounts/HellspyCz.py | 23 ++++++++------- module/plugins/accounts/HotfileCom.py | 41 ++++++++++++++------------- module/plugins/accounts/Http.py | 5 ++-- module/plugins/accounts/MegasharesCom.py | 34 +++++++++++----------- module/plugins/accounts/MultishareCz.py | 25 ++++++++-------- module/plugins/accounts/NetloadIn.py | 14 +++++---- module/plugins/accounts/Premium4Me.py | 8 ++++-- module/plugins/accounts/PremiumizeMe.py | 20 ++++++------- module/plugins/accounts/QuickshareCz.py | 23 +++++++-------- module/plugins/accounts/RapidgatorNet.py | 37 +++++++++++------------- module/plugins/accounts/RapidshareCom.py | 19 +++++++------ module/plugins/accounts/RarefileNet.py | 3 +- module/plugins/accounts/RealdebridCom.py | 9 ++++-- module/plugins/accounts/RehostTo.py | 4 --- module/plugins/accounts/ReloadCc.py | 4 +-- module/plugins/accounts/RyushareCom.py | 12 ++++---- module/plugins/accounts/Share76Com.py | 1 + module/plugins/accounts/ShareFilesCo.py | 1 + module/plugins/accounts/ShareRapidCom.py | 21 +++++++------- module/plugins/accounts/ShareonlineBiz.py | 5 ++-- module/plugins/accounts/SpeedLoadOrg.py | 1 + module/plugins/accounts/StahnuTo.py | 18 ++++++------ module/plugins/accounts/TurbobitNet.py | 16 ++++++----- module/plugins/accounts/UlozTo.py | 28 +++++++++--------- module/plugins/accounts/UploadedTo.py | 17 ++++++----- module/plugins/accounts/UploadheroCom.py | 20 +++++++------ module/plugins/accounts/UploadingCom.py | 15 ++++++---- module/plugins/accounts/UploadstationCom.py | 3 +- module/plugins/accounts/UptoboxCom.py | 5 ++-- module/plugins/accounts/WarserverCz.py | 44 ++++++++++++++--------------- module/plugins/accounts/WuploadCom.py | 3 +- module/plugins/accounts/X7To.py | 7 +++-- module/plugins/accounts/YibaishiwuCom.py | 14 +++++---- module/plugins/accounts/ZeveraCom.py | 28 +++++++++--------- 59 files changed, 462 insertions(+), 393 deletions(-) (limited to 'module/plugins') 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() diff --git a/module/plugins/accounts/BayfilesCom.py b/module/plugins/accounts/BayfilesCom.py index 0d036488b..bf5cc54af 100644 --- a/module/plugins/accounts/BayfilesCom.py +++ b/module/plugins/accounts/BayfilesCom.py @@ -17,10 +17,11 @@ @author: zoidberg """ +from time import time + from module.plugins.Account import Account from module.common.json_layer import json_loads -import re -from time import time, mktime, strptime + class BayfilesCom(Account): __name__ = "BayfilesCom" @@ -33,14 +34,13 @@ class BayfilesCom(Account): def loadAccountInfo(self, user, req): for i in range(2): response = json_loads(req.load("http://api.bayfiles.com/v1/account/info")) - self.logDebug(response) - if not response["error"]: + self.logDebug(response) + if not response["error"]: break self.logWarning(response["error"]) self.relogin() - - return {"premium": bool(response['premium']), \ - "trafficleft": -1, \ + + return {"premium": bool(response['premium']), "trafficleft": -1, "validuntil": response['expires'] if response['expires'] >= int(time()) else -1} def login(self, user, data, req): @@ -48,4 +48,4 @@ class BayfilesCom(Account): self.logDebug(response) if response["error"]: self.logError(response["error"]) - self.wrongPassword() \ No newline at end of file + self.wrongPassword() diff --git a/module/plugins/accounts/BitshareCom.py b/module/plugins/accounts/BitshareCom.py index a4f56e31c..39cff36eb 100644 --- a/module/plugins/accounts/BitshareCom.py +++ b/module/plugins/accounts/BitshareCom.py @@ -19,6 +19,7 @@ from module.plugins.Account import Account + class BitshareCom(Account): __name__ = "BitshareCom" __version__ = "0.11" @@ -28,17 +29,17 @@ class BitshareCom(Account): def loadAccountInfo(self, user, req): page = req.load("http://bitshare.com/mysettings.html") - + if "\"http://bitshare.com/myupgrade.html\">Free" in page: - return {"validuntil": -1, "trafficleft":-1, "premium": False} + return {"validuntil": -1, "trafficleft": -1, "premium": False} if not '' in page: self.core.log.warning(_("Activate direct Download in your Bitshare Account")) return {"validuntil": -1, "trafficleft": -1, "premium": True} - def login(self, user, data, req): - page = req.load("http://bitshare.com/login.html", post={ "user" : user, "password" : data["password"], "submit" :"Login"}, cookies=True) + page = req.load("http://bitshare.com/login.html", + post={"user": user, "password": data["password"], "submit": "Login"}, cookies=True) if "login" in req.lastEffectiveURL: self.wrongPassword() diff --git a/module/plugins/accounts/BoltsharingCom.py b/module/plugins/accounts/BoltsharingCom.py index 678591d1d..76e010532 100644 --- a/module/plugins/accounts/BoltsharingCom.py +++ b/module/plugins/accounts/BoltsharingCom.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from module.plugins.internal.XFSPAccount import XFSPAccount + class BoltsharingCom(XFSPAccount): __name__ = "BoltsharingCom" __version__ = "0.01" diff --git a/module/plugins/accounts/CramitIn.py b/module/plugins/accounts/CramitIn.py index 182c9d647..b0334b191 100644 --- a/module/plugins/accounts/CramitIn.py +++ b/module/plugins/accounts/CramitIn.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from module.plugins.internal.XFSPAccount import XFSPAccount + class CramitIn(XFSPAccount): __name__ = "CramitIn" __version__ = "0.01" @@ -8,5 +9,5 @@ class CramitIn(XFSPAccount): __description__ = """cramit.in account plugin""" __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") - - MAIN_PAGE = "http://cramit.in/" \ No newline at end of file + + MAIN_PAGE = "http://cramit.in/" diff --git a/module/plugins/accounts/CyberlockerCh.py b/module/plugins/accounts/CyberlockerCh.py index 31e0c3e24..0eaa262eb 100644 --- a/module/plugins/accounts/CyberlockerCh.py +++ b/module/plugins/accounts/CyberlockerCh.py @@ -2,6 +2,7 @@ from module.plugins.internal.XFSPAccount import XFSPAccount from module.plugins.internal.SimpleHoster import parseHtmlForm + class CyberlockerCh(XFSPAccount): __name__ = "CyberlockerCh" __version__ = "0.01" @@ -13,7 +14,7 @@ class CyberlockerCh(XFSPAccount): MAIN_PAGE = "http://cyberlocker.ch/" def login(self, user, data, req): - html = req.load(self.MAIN_PAGE + 'login.html', decode = True) + html = req.load(self.MAIN_PAGE + 'login.html', decode=True) action, inputs = parseHtmlForm('name="FL"', html) if not inputs: @@ -25,7 +26,7 @@ class CyberlockerCh(XFSPAccount): # Without this a 403 Forbidden is returned req.http.lastURL = self.MAIN_PAGE + 'login.html' - html = req.load(self.MAIN_PAGE, post = inputs, decode = True) + html = req.load(self.MAIN_PAGE, post=inputs, decode=True) if 'Incorrect Login or Password' in html or '>Error<' in html: self.wrongPassword() diff --git a/module/plugins/accounts/DdlstorageCom.py b/module/plugins/accounts/DdlstorageCom.py index 01d165f23..6c610aa84 100644 --- a/module/plugins/accounts/DdlstorageCom.py +++ b/module/plugins/accounts/DdlstorageCom.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- from module.plugins.internal.XFSPAccount import XFSPAccount + class DdlstorageCom(XFSPAccount): __name__ = "DdlstorageCom" __version__ = "0.01" @@ -8,5 +9,5 @@ class DdlstorageCom(XFSPAccount): __description__ = """DDLStorage.com account plugin""" __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") - - MAIN_PAGE = "http://ddlstorage.com/" \ No newline at end of file + + MAIN_PAGE = "http://ddlstorage.com/" diff --git a/module/plugins/accounts/DebridItaliaCom.py b/module/plugins/accounts/DebridItaliaCom.py index 91dd3787f..82acd8f8e 100644 --- a/module/plugins/accounts/DebridItaliaCom.py +++ b/module/plugins/accounts/DebridItaliaCom.py @@ -16,7 +16,6 @@ ############################################################################ import re -import _strptime import time from module.plugins.Account import Account diff --git a/module/plugins/accounts/DepositfilesCom.py b/module/plugins/accounts/DepositfilesCom.py index b0730de8e..177d7267f 100644 --- a/module/plugins/accounts/DepositfilesCom.py +++ b/module/plugins/accounts/DepositfilesCom.py @@ -17,10 +17,12 @@ @author: mkaay """ -from module.plugins.Account import Account import re from time import strptime, mktime +from module.plugins.Account import Account + + class DepositfilesCom(Account): __name__ = "DepositfilesCom" __version__ = "0.1" @@ -28,20 +30,19 @@ class DepositfilesCom(Account): __description__ = """depositfiles.com account plugin""" __author_name__ = ("mkaay") __author_mail__ = ("mkaay@mkaay.de") - - def loadAccountInfo(self, user, req): + def loadAccountInfo(self, user, req): src = req.load("http://depositfiles.com/de/gold/") validuntil = re.search("noch den Gold-Zugriff: (.*?)", src).group(1) validuntil = int(mktime(strptime(validuntil, "%Y-%m-%d %H:%M:%S"))) - tmp = {"validuntil":validuntil, "trafficleft":-1} + tmp = {"validuntil": validuntil, "trafficleft": -1} return tmp - - def login(self, user, data, req): + def login(self, user, data, req): req.load("http://depositfiles.com/de/gold/payment.php") - src = req.load("http://depositfiles.com/de/login.php", get={"return": "/de/gold/payment.php"}, post={"login": user, "password": data["password"]}) + src = req.load("http://depositfiles.com/de/login.php", get={"return": "/de/gold/payment.php"}, + post={"login": user, "password": data["password"]}) if r'
Sie haben eine falsche Benutzername-Passwort-Kombination verwendet.
' in src: self.wrongPassword() diff --git a/module/plugins/accounts/EasybytezCom.py b/module/plugins/accounts/EasybytezCom.py index ba7829b83..cd995fbe5 100644 --- a/module/plugins/accounts/EasybytezCom.py +++ b/module/plugins/accounts/EasybytezCom.py @@ -17,11 +17,13 @@ @author: zoidberg """ +import re +from time import mktime, strptime + from module.plugins.Account import Account from module.plugins.internal.SimpleHoster import parseHtmlForm -import re from module.utils import parseFileSize -from time import mktime, strptime + class EasybytezCom(Account): __name__ = "EasybytezCom" @@ -30,16 +32,16 @@ class EasybytezCom(Account): __description__ = """EasyBytez.com account plugin""" __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") - + VALID_UNTIL_PATTERN = r'Premium account expire:([^<]+)' TRAFFIC_LEFT_PATTERN = r'Traffic available today:(?P[^<]+)' - def loadAccountInfo(self, user, req): - html = req.load("http://www.easybytez.com/?op=my_account", decode = True) - + def loadAccountInfo(self, user, req): + html = req.load("http://www.easybytez.com/?op=my_account", decode=True) + validuntil = trafficleft = None premium = False - + found = re.search(self.VALID_UNTIL_PATTERN, html) if found: premium = True @@ -56,18 +58,18 @@ class EasybytezCom(Account): if "Unlimited" in trafficleft: premium = True else: - trafficleft = parseFileSize(trafficleft) / 1024 - - return ({"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium}) - + trafficleft = parseFileSize(trafficleft) / 1024 + + return {"validuntil": validuntil, "trafficleft": trafficleft, "premium": premium} + def login(self, user, data, req): - html = req.load('http://www.easybytez.com/login.html', decode = True) + html = req.load('http://www.easybytez.com/login.html', decode=True) action, inputs = parseHtmlForm('name="FL"', html) inputs.update({"login": user, "password": data['password'], "redirect": "http://www.easybytez.com/"}) - - html = req.load(action, post = inputs, decode = True) - - if 'Incorrect Login or Password' in html or '>Error<' in html: - self.wrongPassword() \ No newline at end of file + + html = req.load(action, post=inputs, decode=True) + + if 'Incorrect Login or Password' in html or '>Error<' in html: + self.wrongPassword() diff --git a/module/plugins/accounts/EgoFilesCom.py b/module/plugins/accounts/EgoFilesCom.py index da1ed03ad..9c2b918c3 100644 --- a/module/plugins/accounts/EgoFilesCom.py +++ b/module/plugins/accounts/EgoFilesCom.py @@ -1,10 +1,12 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account import re import time + +from module.plugins.Account import Account from module.utils import parseFileSize + class EgoFilesCom(Account): __name__ = "EgoFilesCom" __version__ = "0.2" diff --git a/module/plugins/accounts/EuroshareEu.py b/module/plugins/accounts/EuroshareEu.py index 42967d975..830c1db3f 100644 --- a/module/plugins/accounts/EuroshareEu.py +++ b/module/plugins/accounts/EuroshareEu.py @@ -17,11 +17,12 @@ @author: zoidberg """ -from module.plugins.Account import Account from time import mktime, strptime -from string import replace import re +from module.plugins.Account import Account + + class EuroshareEu(Account): __name__ = "EuroshareEu" __version__ = "0.01" @@ -33,23 +34,23 @@ class EuroshareEu(Account): def loadAccountInfo(self, user, req): self.relogin(user) html = req.load("http://euroshare.eu/customer-zone/settings/") - + found = re.search('id="input_expire_date" value="(\d+\.\d+\.\d+ \d+:\d+)"', html) if found is None: premium, validuntil = False, -1 else: premium = True validuntil = mktime(strptime(found.group(1), "%d.%m.%Y %H:%M")) - + return {"validuntil": validuntil, "trafficleft": -1, "premium": premium} - + def login(self, user, data, req): - + html = req.load('http://euroshare.eu/customer-zone/login/', post={ - "trvale": "1", - "login": user, - "password": data["password"] - }, decode=True) - + "trvale": "1", + "login": user, + "password": data["password"] + }, decode=True) + if u">Nesprávne prihlasovacie meno alebo heslo" in html: - self.wrongPassword() \ No newline at end of file + self.wrongPassword() diff --git a/module/plugins/accounts/FilebeerInfo.py b/module/plugins/accounts/FilebeerInfo.py index 40ab70519..3c3a9edfd 100644 --- a/module/plugins/accounts/FilebeerInfo.py +++ b/module/plugins/accounts/FilebeerInfo.py @@ -20,7 +20,7 @@ import re from time import mktime, strptime from module.plugins.Account import Account -from module.utils import parseFileSize + class FilebeerInfo(Account): __name__ = "FilebeerInfo" @@ -29,29 +29,29 @@ class FilebeerInfo(Account): __description__ = """filebeer.info account plugin""" __author_name__ = ("zoidberg") __author_mail__ = ("zoidberg@mujmail.cz") - + VALID_UNTIL_PATTERN = r'Reverts To Free Account:\s\s*\s*(.*?)\s*' - + def loadAccountInfo(self, user, req): - html = req.load("http://filebeer.info/upgrade.php", decode = True) + html = req.load("http://filebeer.info/upgrade.php", decode=True) premium = not 'Free User ' in html - + validuntil = None if premium: try: - validuntil = mktime(strptime(re.search(self.VALID_UNTIL_PATTERN, html).group(1), "%d/%m/%Y %H:%M:%S")) + validuntil = mktime(strptime(re.search(self.VALID_UNTIL_PATTERN, html).group(1), "%d/%m/%Y %H:%M:%S")) except Exception, e: self.logError("Unable to parse account info", e) return {"validuntil": validuntil, "trafficleft": -1, "premium": premium} - + def login(self, user, data, req): - html = req.load('http://filebeer.info/login.php', post = { + html = req.load('http://filebeer.info/login.php', post={ "submit": 'Login', "loginPassword": data['password'], "loginUsername": user, "submitme": '1' - }, decode = True) - + }, decode=True) + if "