From f8ee62fa313beddc7af46dc1c361adb8577d0fa4 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 2 Jun 2015 03:26:41 +0200 Subject: Fix https://github.com/pyload/pyload/issues/1446 --- module/plugins/accounts/WebshareCz.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/accounts/WebshareCz.py') diff --git a/module/plugins/accounts/WebshareCz.py b/module/plugins/accounts/WebshareCz.py index f032e2317..8c53dd41e 100644 --- a/module/plugins/accounts/WebshareCz.py +++ b/module/plugins/accounts/WebshareCz.py @@ -12,7 +12,7 @@ from module.plugins.Account import Account class WebshareCz(Account): __name__ = "WebshareCz" __type__ = "account" - __version__ = "0.07" + __version__ = "0.08" __description__ = """Webshare.cz account plugin""" __license__ = "GPLv3" @@ -26,7 +26,7 @@ class WebshareCz(Account): def loadAccountInfo(self, user, req): html = req.load("https://webshare.cz/api/user_data/", - post={'wst': self.infos['wst']}, + post={'wst': self.getAccountData(user).get('wst', None)}, decode=True) self.logDebug("Response: " + html) @@ -65,4 +65,4 @@ class WebshareCz(Account): if "OK" not in login: self.wrongPassword() - self.infos['wst'] = re.search('(.+)', login).group(1) + data['wst'] = re.search('(.+)', login).group(1) -- cgit v1.2.3 From 0e1ef9bc01579328e17e79416fa3c1c7b77adcc8 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 8 Jun 2015 06:08:01 +0200 Subject: Update everything --- module/plugins/accounts/WebshareCz.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/accounts/WebshareCz.py') diff --git a/module/plugins/accounts/WebshareCz.py b/module/plugins/accounts/WebshareCz.py index 8c53dd41e..c88e86aba 100644 --- a/module/plugins/accounts/WebshareCz.py +++ b/module/plugins/accounts/WebshareCz.py @@ -6,13 +6,13 @@ import time from passlib.hash import md5_crypt -from module.plugins.Account import Account +from module.plugins.internal.Account import Account class WebshareCz(Account): __name__ = "WebshareCz" __type__ = "account" - __version__ = "0.08" + __version__ = "0.09" __description__ = """Webshare.cz account plugin""" __license__ = "GPLv3" -- cgit v1.2.3 From c1764e2fea0bb05164c83a876e8cd58b97f58f25 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 16 Jun 2015 17:31:38 +0200 Subject: Update all --- module/plugins/accounts/WebshareCz.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) (limited to 'module/plugins/accounts/WebshareCz.py') diff --git a/module/plugins/accounts/WebshareCz.py b/module/plugins/accounts/WebshareCz.py index c88e86aba..d0f5524a2 100644 --- a/module/plugins/accounts/WebshareCz.py +++ b/module/plugins/accounts/WebshareCz.py @@ -25,9 +25,8 @@ class WebshareCz(Account): def loadAccountInfo(self, user, req): - html = req.load("https://webshare.cz/api/user_data/", - post={'wst': self.getAccountData(user).get('wst', None)}, - decode=True) + html = self.load("https://webshare.cz/api/user_data/", + post={'wst': self.getAccountData(user).get('wst', None)}) self.logDebug("Response: " + html) @@ -42,10 +41,9 @@ class WebshareCz(Account): def login(self, user, data, req): - salt = req.load("https://webshare.cz/api/salt/", + salt = self.load("https://webshare.cz/api/salt/", post={'username_or_email': user, - 'wst' : ""}, - decode=True) + 'wst' : ""}, req=req) if "OK" not in salt: self.wrongPassword() @@ -54,13 +52,12 @@ class WebshareCz(Account): password = hashlib.sha1(md5_crypt.encrypt(data["password"], salt=salt)).hexdigest() digest = hashlib.md5(user + ":Webshare:" + password).hexdigest() - login = req.load("https://webshare.cz/api/login/", + login = self.load("https://webshare.cz/api/login/", post={'digest' : digest, 'keep_logged_in' : 1, 'password' : password, 'username_or_email': user, - 'wst' : ""}, - decode=True) + 'wst' : ""}, req=req) if "OK" not in login: self.wrongPassword() -- cgit v1.2.3 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/WebshareCz.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/accounts/WebshareCz.py') 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 From b1759bc440cd6013837697eb8de540914f693ffd Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Tue, 7 Jul 2015 01:23:55 +0200 Subject: No camelCase style anymore --- module/plugins/accounts/WebshareCz.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'module/plugins/accounts/WebshareCz.py') diff --git a/module/plugins/accounts/WebshareCz.py b/module/plugins/accounts/WebshareCz.py index b1ecef3fd..c8711838f 100644 --- a/module/plugins/accounts/WebshareCz.py +++ b/module/plugins/accounts/WebshareCz.py @@ -12,7 +12,7 @@ from module.plugins.internal.Account import Account class WebshareCz(Account): __name__ = "WebshareCz" __type__ = "account" - __version__ = "0.09" + __version__ = "0.10" __description__ = """Webshare.cz account plugin""" __license__ = "GPLv3" @@ -24,17 +24,17 @@ class WebshareCz(Account): TRAFFIC_LEFT_PATTERN = r'(.+)' - def loadAccountInfo(self, user, req): + def load_account_info(self, user, req): html = self.load("https://webshare.cz/api/user_data/", - post={'wst': self.getAccountData(user).get('wst', None)}) + post={'wst': self.get_account_data(user).get('wst', None)}) - self.logDebug("Response: " + html) + self.log_debug("Response: " + html) expiredate = re.search(self.VALID_UNTIL_PATTERN, html).group(1) - self.logDebug("Expire date: " + expiredate) + self.log_debug("Expire date: " + expiredate) validuntil = time.mktime(time.strptime(expiredate, "%Y-%m-%d %H:%M:%S")) - trafficleft = self.parseTraffic(re.search(self.TRAFFIC_LEFT_PATTERN, html).group(1)) + trafficleft = self.parse_traffic(re.search(self.TRAFFIC_LEFT_PATTERN, html).group(1)) premium = validuntil > time.time() return {'validuntil': validuntil, 'trafficleft': -1, 'premium': premium} @@ -46,7 +46,7 @@ class WebshareCz(Account): 'wst' : ""}, req=req) if "OK" not in salt: - self.wrongPassword() + self.wrong_password() salt = re.search('(.+)', salt).group(1) password = hashlib.sha1(md5_crypt.encrypt(data['password'], salt=salt)).hexdigest() @@ -60,6 +60,6 @@ class WebshareCz(Account): 'wst' : ""}, req=req) if "OK" not in login: - self.wrongPassword() + self.wrong_password() data['wst'] = re.search('(.+)', login).group(1) -- cgit v1.2.3 From d2e2b127651a5a44b56337eb6d9ca246c97a208a Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 17 Jul 2015 03:03:26 +0200 Subject: Spare fixes and code cosmetics --- module/plugins/accounts/WebshareCz.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) (limited to 'module/plugins/accounts/WebshareCz.py') diff --git a/module/plugins/accounts/WebshareCz.py b/module/plugins/accounts/WebshareCz.py index c8711838f..9f392bdb0 100644 --- a/module/plugins/accounts/WebshareCz.py +++ b/module/plugins/accounts/WebshareCz.py @@ -42,8 +42,9 @@ class WebshareCz(Account): def login(self, user, data, req): salt = self.load("https://webshare.cz/api/salt/", - post={'username_or_email': user, - 'wst' : ""}, req=req) + post={'username_or_email': user, + 'wst' : ""}, + req=req) if "OK" not in salt: self.wrong_password() @@ -53,11 +54,12 @@ class WebshareCz(Account): digest = hashlib.md5(user + ":Webshare:" + password).hexdigest() login = self.load("https://webshare.cz/api/login/", - post={'digest' : digest, - 'keep_logged_in' : 1, - 'password' : password, - 'username_or_email': user, - 'wst' : ""}, req=req) + post={'digest' : digest, + 'keep_logged_in' : 1, + 'password' : password, + 'username_or_email': user, + 'wst' : ""}, + req=req) if "OK" not in login: self.wrong_password() -- cgit v1.2.3 From 1f5a55ae2133a782bdcca334ecbcdbde50dbcf99 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 17 Jul 2015 15:29:48 +0200 Subject: No more need to use the req argument when call load method --- module/plugins/accounts/WebshareCz.py | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'module/plugins/accounts/WebshareCz.py') diff --git a/module/plugins/accounts/WebshareCz.py b/module/plugins/accounts/WebshareCz.py index 9f392bdb0..554d38951 100644 --- a/module/plugins/accounts/WebshareCz.py +++ b/module/plugins/accounts/WebshareCz.py @@ -43,8 +43,7 @@ class WebshareCz(Account): def login(self, user, data, req): salt = self.load("https://webshare.cz/api/salt/", post={'username_or_email': user, - 'wst' : ""}, - req=req) + 'wst' : ""}) if "OK" not in salt: self.wrong_password() @@ -58,8 +57,7 @@ class WebshareCz(Account): 'keep_logged_in' : 1, 'password' : password, 'username_or_email': user, - 'wst' : ""}, - req=req) + 'wst' : ""}) if "OK" not in login: self.wrong_password() -- cgit v1.2.3 From d38e830b7c0b3c6561a0072c74bbccb5fcdf4a61 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Jul 2015 14:43:42 +0200 Subject: New __status__ magic key --- module/plugins/accounts/WebshareCz.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/accounts/WebshareCz.py') diff --git a/module/plugins/accounts/WebshareCz.py b/module/plugins/accounts/WebshareCz.py index 554d38951..2877551f0 100644 --- a/module/plugins/accounts/WebshareCz.py +++ b/module/plugins/accounts/WebshareCz.py @@ -13,6 +13,7 @@ class WebshareCz(Account): __name__ = "WebshareCz" __type__ = "account" __version__ = "0.10" + __status__ = "stable" __description__ = """Webshare.cz account plugin""" __license__ = "GPLv3" -- cgit v1.2.3 From 94d017cd2a5c1f194960827a8c7e46afc3682008 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 24 Jul 2015 06:55:49 +0200 Subject: Hotfixes (2) --- module/plugins/accounts/WebshareCz.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/accounts/WebshareCz.py') diff --git a/module/plugins/accounts/WebshareCz.py b/module/plugins/accounts/WebshareCz.py index 2877551f0..7d0da3cbd 100644 --- a/module/plugins/accounts/WebshareCz.py +++ b/module/plugins/accounts/WebshareCz.py @@ -13,7 +13,7 @@ class WebshareCz(Account): __name__ = "WebshareCz" __type__ = "account" __version__ = "0.10" - __status__ = "stable" + __status__ = "testing" __description__ = """Webshare.cz account plugin""" __license__ = "GPLv3" -- cgit v1.2.3 From 8f17f875f6e28f73ddb10da59c6464bd04922222 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 25 Jul 2015 04:59:27 +0200 Subject: Account rewritten --- module/plugins/accounts/WebshareCz.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'module/plugins/accounts/WebshareCz.py') diff --git a/module/plugins/accounts/WebshareCz.py b/module/plugins/accounts/WebshareCz.py index 7d0da3cbd..1f2adb7f5 100644 --- a/module/plugins/accounts/WebshareCz.py +++ b/module/plugins/accounts/WebshareCz.py @@ -25,9 +25,9 @@ class WebshareCz(Account): TRAFFIC_LEFT_PATTERN = r'(.+)' - def load_account_info(self, user, req): + def parse_info(self, user, password, data, req): html = self.load("https://webshare.cz/api/user_data/", - post={'wst': self.get_account_data(user).get('wst', None)}) + post={'wst': self.get_data(user).get('wst', None)}) self.log_debug("Response: " + html) @@ -41,16 +41,16 @@ class WebshareCz(Account): return {'validuntil': validuntil, 'trafficleft': -1, 'premium': premium} - def login(self, user, data, req): + def login(self, user, password, data, req): salt = self.load("https://webshare.cz/api/salt/", post={'username_or_email': user, 'wst' : ""}) if "OK" not in salt: - self.wrong_password() + self.fail() salt = re.search('(.+)', salt).group(1) - password = hashlib.sha1(md5_crypt.encrypt(data['password'], salt=salt)).hexdigest() + password = hashlib.sha1(md5_crypt.encrypt(password, salt=salt)).hexdigest() digest = hashlib.md5(user + ":Webshare:" + password).hexdigest() login = self.load("https://webshare.cz/api/login/", @@ -61,6 +61,6 @@ class WebshareCz(Account): 'wst' : ""}) if "OK" not in login: - self.wrong_password() + self.fail() data['wst'] = re.search('(.+)', login).group(1) -- cgit v1.2.3 From a95c217627a1cb651b24e69f20640df40797aff9 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 25 Jul 2015 09:34:18 +0200 Subject: Account rewritten (2) --- module/plugins/accounts/WebshareCz.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/accounts/WebshareCz.py') diff --git a/module/plugins/accounts/WebshareCz.py b/module/plugins/accounts/WebshareCz.py index 1f2adb7f5..bbfb90a92 100644 --- a/module/plugins/accounts/WebshareCz.py +++ b/module/plugins/accounts/WebshareCz.py @@ -47,7 +47,7 @@ class WebshareCz(Account): 'wst' : ""}) if "OK" not in salt: - self.fail() + self.login_fail() salt = re.search('(.+)', salt).group(1) password = hashlib.sha1(md5_crypt.encrypt(password, salt=salt)).hexdigest() @@ -61,6 +61,6 @@ class WebshareCz(Account): 'wst' : ""}) if "OK" not in login: - self.fail() + self.login_fail() data['wst'] = re.search('(.+)', login).group(1) -- cgit v1.2.3