From 9305859b64a2f0aef3f27fb7e5b75caa0cb836a6 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 17 Jun 2015 19:24:49 +0200 Subject: Spare code cosmetics (3) --- module/plugins/accounts/NoPremiumPl.py | 12 ++++++------ module/plugins/accounts/RapideoPl.py | 12 ++++++------ module/plugins/accounts/SmoozedCom.py | 10 +++++----- module/plugins/accounts/UploadableCh.py | 2 +- module/plugins/accounts/WebshareCz.py | 2 +- 5 files changed, 19 insertions(+), 19 deletions(-) (limited to 'module/plugins/accounts') diff --git a/module/plugins/accounts/NoPremiumPl.py b/module/plugins/accounts/NoPremiumPl.py index 30822791b..01060250b 100644 --- a/module/plugins/accounts/NoPremiumPl.py +++ b/module/plugins/accounts/NoPremiumPl.py @@ -42,11 +42,11 @@ class NoPremiumPl(Account): premium = False valid_untill = -1 - if "expire" in result.keys() and result["expire"]: + if "expire" in result.keys() and result['expire']: premium = True - valid_untill = time.mktime(datetime.datetime.fromtimestamp(int(result["expire"])).timetuple()) + valid_untill = time.mktime(datetime.datetime.fromtimestamp(int(result['expire'])).timetuple()) - traffic_left = result["balance"] * 1024 + traffic_left = result['balance'] * 1024 return {'validuntil' : valid_untill, 'trafficleft': traffic_left, @@ -55,7 +55,7 @@ class NoPremiumPl(Account): def login(self, user, data, req): self._usr = user - self._pwd = hashlib.sha1(hashlib.md5(data["password"]).hexdigest()).hexdigest() + self._pwd = hashlib.sha1(hashlib.md5(data['password']).hexdigest()).hexdigest() self._req = req try: @@ -72,8 +72,8 @@ class NoPremiumPl(Account): def createAuthQuery(self): query = self.API_QUERY - query["username"] = self._usr - query["password"] = self._pwd + query['username'] = self._usr + query['password'] = self._pwd return query diff --git a/module/plugins/accounts/RapideoPl.py b/module/plugins/accounts/RapideoPl.py index 0fc934255..f5ce2e2b1 100644 --- a/module/plugins/accounts/RapideoPl.py +++ b/module/plugins/accounts/RapideoPl.py @@ -42,11 +42,11 @@ class RapideoPl(Account): premium = False valid_untill = -1 - if "expire" in result.keys() and result["expire"]: + if "expire" in result.keys() and result['expire']: premium = True - valid_untill = time.mktime(datetime.datetime.fromtimestamp(int(result["expire"])).timetuple()) + valid_untill = time.mktime(datetime.datetime.fromtimestamp(int(result['expire'])).timetuple()) - traffic_left = result["balance"] + traffic_left = result['balance'] return {'validuntil' : valid_untill, 'trafficleft': traffic_left, @@ -55,7 +55,7 @@ class RapideoPl(Account): def login(self, user, data, req): self._usr = user - self._pwd = hashlib.md5(data["password"]).hexdigest() + self._pwd = hashlib.md5(data['password']).hexdigest() self._req = req try: @@ -72,8 +72,8 @@ class RapideoPl(Account): def createAuthQuery(self): query = self.API_QUERY - query["username"] = self._usr - query["password"] = self._pwd + query['username'] = self._usr + query['password'] = self._pwd return query diff --git a/module/plugins/accounts/SmoozedCom.py b/module/plugins/accounts/SmoozedCom.py index 148818957..0b0d7ed74 100644 --- a/module/plugins/accounts/SmoozedCom.py +++ b/module/plugins/accounts/SmoozedCom.py @@ -44,13 +44,13 @@ class SmoozedCom(Account): 'premium' : False} else: #: Parse account info - info = {'validuntil' : float(status["data"]["user"]["user_premium"]), - 'trafficleft': max(0, status["data"]["traffic"][1] - status["data"]["traffic"][0]), - 'session' : status["data"]["session_key"], - 'hosters' : [hoster["name"] for hoster in status["data"]["hoster"]]} + info = {'validuntil' : float(status['data']['user']['user_premium']), + 'trafficleft': max(0, status['data']['traffic'][1] - status['data']['traffic'][0]), + 'session' : status['data']['session_key'], + 'hosters' : [hoster['name'] for hoster in status['data']['hoster']]} if info['validuntil'] < time.time(): - if float(status["data"]["user"].get("user_trial", 0)) > time.time(): + if float(status['data']['user'].get("user_trial", 0)) > time.time(): info['premium'] = True else: info['premium'] = False diff --git a/module/plugins/accounts/UploadableCh.py b/module/plugins/accounts/UploadableCh.py index b0def5600..2936a2a6b 100644 --- a/module/plugins/accounts/UploadableCh.py +++ b/module/plugins/accounts/UploadableCh.py @@ -25,7 +25,7 @@ class UploadableCh(Account): def login(self, user, data, req): html = self.load("http://www.uploadable.ch/login.php", post={'userName' : user, - 'userPassword' : data["password"], + 'userPassword' : data['password'], 'autoLogin' : "1", 'action__login': "normalLogin"}, req=req) diff --git a/module/plugins/accounts/WebshareCz.py b/module/plugins/accounts/WebshareCz.py index d0f5524a2..b1ecef3fd 100644 --- a/module/plugins/accounts/WebshareCz.py +++ b/module/plugins/accounts/WebshareCz.py @@ -49,7 +49,7 @@ class WebshareCz(Account): self.wrongPassword() salt = re.search('(.+)', salt).group(1) - password = hashlib.sha1(md5_crypt.encrypt(data["password"], salt=salt)).hexdigest() + password = hashlib.sha1(md5_crypt.encrypt(data['password'], salt=salt)).hexdigest() digest = hashlib.md5(user + ":Webshare:" + password).hexdigest() login = self.load("https://webshare.cz/api/login/", -- cgit v1.2.3