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/FilecloudIo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/accounts/FilecloudIo.py') diff --git a/module/plugins/accounts/FilecloudIo.py b/module/plugins/accounts/FilecloudIo.py index 8ca55b1bc..c5239405e 100644 --- a/module/plugins/accounts/FilecloudIo.py +++ b/module/plugins/accounts/FilecloudIo.py @@ -1,13 +1,13 @@ # -*- coding: utf-8 -*- -from module.plugins.Account import Account +from module.plugins.internal.Account import Account from module.common.json_layer import json_loads class FilecloudIo(Account): __name__ = "FilecloudIo" __type__ = "account" - __version__ = "0.04" + __version__ = "0.05" __description__ = """FilecloudIo 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/FilecloudIo.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'module/plugins/accounts/FilecloudIo.py') diff --git a/module/plugins/accounts/FilecloudIo.py b/module/plugins/accounts/FilecloudIo.py index c5239405e..300159acf 100644 --- a/module/plugins/accounts/FilecloudIo.py +++ b/module/plugins/accounts/FilecloudIo.py @@ -18,7 +18,7 @@ class FilecloudIo(Account): def loadAccountInfo(self, user, req): # It looks like the first API request always fails, so we retry 5 times, it should work on the second try for _i in xrange(5): - rep = req.load("https://secure.filecloud.io/api-fetch_apikey.api", + rep = self.load("https://secure.filecloud.io/api-fetch_apikey.api", post={"username": user, "password": self.getAccountData(user)['password']}) rep = json_loads(rep) if rep['status'] == 'ok': @@ -31,8 +31,8 @@ class FilecloudIo(Account): akey = rep['akey'] self.accounts[user]['akey'] = akey # Saved for hoster plugin - rep = req.load("http://api.filecloud.io/api-fetch_account_details.api", - post={"akey": akey}) + rep = self.load("http://api.filecloud.io/api-fetch_account_details.api", + post={"akey": akey}, req=req) rep = json_loads(rep) if rep['is_premium'] == 1: @@ -43,7 +43,7 @@ class FilecloudIo(Account): def login(self, user, data, req): req.cj.setCookie("secure.filecloud.io", "lang", "en") - html = req.load('https://secure.filecloud.io/user-login.html') + html = self.load('https://secure.filecloud.io/user-login.html', req=req) if not hasattr(self, "form_data"): self.form_data = {} @@ -51,9 +51,9 @@ class FilecloudIo(Account): self.form_data['username'] = user self.form_data['password'] = data['password'] - html = req.load('https://secure.filecloud.io/user-login_p.html', - post=self.form_data, - multipart=True) + html = self.load('https://secure.filecloud.io/user-login_p.html', + post=self.form_data, + req=req) if "you have successfully logged in" not in html: self.wrongPassword() -- cgit v1.2.3 From 20b6a2ec022202b0efb6cb69415239fb8f4d1445 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Wed, 17 Jun 2015 18:59:20 +0200 Subject: Spare code cosmetics (2) --- module/plugins/accounts/FilecloudIo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/accounts/FilecloudIo.py') diff --git a/module/plugins/accounts/FilecloudIo.py b/module/plugins/accounts/FilecloudIo.py index 300159acf..4d69a2ae2 100644 --- a/module/plugins/accounts/FilecloudIo.py +++ b/module/plugins/accounts/FilecloudIo.py @@ -16,7 +16,7 @@ class FilecloudIo(Account): def loadAccountInfo(self, user, req): - # It looks like the first API request always fails, so we retry 5 times, it should work on the second try + #: It looks like the first API request always fails, so we retry 5 times, it should work on the second try for _i in xrange(5): rep = self.load("https://secure.filecloud.io/api-fetch_apikey.api", post={"username": user, "password": self.getAccountData(user)['password']}) @@ -30,7 +30,7 @@ class FilecloudIo(Account): return {"premium": False} akey = rep['akey'] - self.accounts[user]['akey'] = akey # Saved for hoster plugin + self.accounts[user]['akey'] = akey #: Saved for hoster plugin rep = self.load("http://api.filecloud.io/api-fetch_account_details.api", post={"akey": akey}, req=req) rep = json_loads(rep) -- 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/FilecloudIo.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'module/plugins/accounts/FilecloudIo.py') diff --git a/module/plugins/accounts/FilecloudIo.py b/module/plugins/accounts/FilecloudIo.py index 4d69a2ae2..3c3f79ed8 100644 --- a/module/plugins/accounts/FilecloudIo.py +++ b/module/plugins/accounts/FilecloudIo.py @@ -7,7 +7,7 @@ from module.common.json_layer import json_loads class FilecloudIo(Account): __name__ = "FilecloudIo" __type__ = "account" - __version__ = "0.05" + __version__ = "0.06" __description__ = """FilecloudIo account plugin""" __license__ = "GPLv3" @@ -15,16 +15,16 @@ class FilecloudIo(Account): ("stickell", "l.stickell@yahoo.it")] - def loadAccountInfo(self, user, req): + def load_account_info(self, user, req): #: It looks like the first API request always fails, so we retry 5 times, it should work on the second try for _i in xrange(5): rep = self.load("https://secure.filecloud.io/api-fetch_apikey.api", - post={"username": user, "password": self.getAccountData(user)['password']}) + post={"username": user, "password": self.get_account_data(user)['password']}) rep = json_loads(rep) if rep['status'] == 'ok': break elif rep['status'] == 'error' and rep['message'] == 'no such user or wrong password': - self.logError(_("Wrong username or password")) + self.log_error(_("Wrong username or password")) return {"valid": False, "premium": False} else: return {"premium": False} @@ -56,4 +56,4 @@ class FilecloudIo(Account): req=req) if "you have successfully logged in" not in html: - self.wrongPassword() + self.wrong_password() -- 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/FilecloudIo.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'module/plugins/accounts/FilecloudIo.py') diff --git a/module/plugins/accounts/FilecloudIo.py b/module/plugins/accounts/FilecloudIo.py index 3c3f79ed8..512a7b67d 100644 --- a/module/plugins/accounts/FilecloudIo.py +++ b/module/plugins/accounts/FilecloudIo.py @@ -32,7 +32,8 @@ class FilecloudIo(Account): akey = rep['akey'] self.accounts[user]['akey'] = akey #: Saved for hoster plugin rep = self.load("http://api.filecloud.io/api-fetch_account_details.api", - post={"akey": akey}, req=req) + post={"akey": akey}, + req=req) rep = json_loads(rep) if rep['is_premium'] == 1: -- 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/FilecloudIo.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'module/plugins/accounts/FilecloudIo.py') diff --git a/module/plugins/accounts/FilecloudIo.py b/module/plugins/accounts/FilecloudIo.py index 512a7b67d..d8b60ccbc 100644 --- a/module/plugins/accounts/FilecloudIo.py +++ b/module/plugins/accounts/FilecloudIo.py @@ -32,8 +32,7 @@ class FilecloudIo(Account): akey = rep['akey'] self.accounts[user]['akey'] = akey #: Saved for hoster plugin rep = self.load("http://api.filecloud.io/api-fetch_account_details.api", - post={"akey": akey}, - req=req) + post={"akey": akey}) rep = json_loads(rep) if rep['is_premium'] == 1: @@ -44,7 +43,7 @@ class FilecloudIo(Account): def login(self, user, data, req): req.cj.setCookie("secure.filecloud.io", "lang", "en") - html = self.load('https://secure.filecloud.io/user-login.html', req=req) + html = self.load('https://secure.filecloud.io/user-login.html') if not hasattr(self, "form_data"): self.form_data = {} @@ -53,8 +52,7 @@ class FilecloudIo(Account): self.form_data['password'] = data['password'] html = self.load('https://secure.filecloud.io/user-login_p.html', - post=self.form_data, - req=req) + post=self.form_data) if "you have successfully logged in" not in html: self.wrong_password() -- cgit v1.2.3 From ff9383bfe06d14d23bc0ed6af79aa8967965d078 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Jul 2015 10:59:52 +0200 Subject: Code cosmetics (3) --- module/plugins/accounts/FilecloudIo.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'module/plugins/accounts/FilecloudIo.py') diff --git a/module/plugins/accounts/FilecloudIo.py b/module/plugins/accounts/FilecloudIo.py index d8b60ccbc..5e31988b7 100644 --- a/module/plugins/accounts/FilecloudIo.py +++ b/module/plugins/accounts/FilecloudIo.py @@ -19,26 +19,26 @@ class FilecloudIo(Account): #: It looks like the first API request always fails, so we retry 5 times, it should work on the second try for _i in xrange(5): rep = self.load("https://secure.filecloud.io/api-fetch_apikey.api", - post={"username": user, "password": self.get_account_data(user)['password']}) + post={'username': user, 'password': self.get_account_data(user)['password']}) rep = json_loads(rep) if rep['status'] == 'ok': break elif rep['status'] == 'error' and rep['message'] == 'no such user or wrong password': self.log_error(_("Wrong username or password")) - return {"valid": False, "premium": False} + return {'valid': False, 'premium': False} else: - return {"premium": False} + return {'premium': False} akey = rep['akey'] self.accounts[user]['akey'] = akey #: Saved for hoster plugin rep = self.load("http://api.filecloud.io/api-fetch_account_details.api", - post={"akey": akey}) + post={'akey': akey}) rep = json_loads(rep) if rep['is_premium'] == 1: - return {"validuntil": float(rep['premium_until']), "trafficleft": -1} + return {'validuntil': float(rep['premium_until']), 'trafficleft': -1} else: - return {"premium": False} + return {'premium': False} def login(self, user, data, req): -- 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/FilecloudIo.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/accounts/FilecloudIo.py') diff --git a/module/plugins/accounts/FilecloudIo.py b/module/plugins/accounts/FilecloudIo.py index 5e31988b7..0c086b03e 100644 --- a/module/plugins/accounts/FilecloudIo.py +++ b/module/plugins/accounts/FilecloudIo.py @@ -8,6 +8,7 @@ class FilecloudIo(Account): __name__ = "FilecloudIo" __type__ = "account" __version__ = "0.06" + __status__ = "stable" __description__ = """FilecloudIo 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/FilecloudIo.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/accounts/FilecloudIo.py') diff --git a/module/plugins/accounts/FilecloudIo.py b/module/plugins/accounts/FilecloudIo.py index 0c086b03e..379dcfac3 100644 --- a/module/plugins/accounts/FilecloudIo.py +++ b/module/plugins/accounts/FilecloudIo.py @@ -8,7 +8,7 @@ class FilecloudIo(Account): __name__ = "FilecloudIo" __type__ = "account" __version__ = "0.06" - __status__ = "stable" + __status__ = "testing" __description__ = """FilecloudIo account plugin""" __license__ = "GPLv3" -- cgit v1.2.3 From 761ca5c66e07559925ebbdbc6531f9ca658b12ce Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Fri, 24 Jul 2015 16:11:58 +0200 Subject: Code cosmetics --- module/plugins/accounts/FilecloudIo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/accounts/FilecloudIo.py') diff --git a/module/plugins/accounts/FilecloudIo.py b/module/plugins/accounts/FilecloudIo.py index 379dcfac3..021160f03 100644 --- a/module/plugins/accounts/FilecloudIo.py +++ b/module/plugins/accounts/FilecloudIo.py @@ -22,9 +22,9 @@ class FilecloudIo(Account): rep = self.load("https://secure.filecloud.io/api-fetch_apikey.api", post={'username': user, 'password': self.get_account_data(user)['password']}) rep = json_loads(rep) - if rep['status'] == 'ok': + if rep['status'] == "ok": break - elif rep['status'] == 'error' and rep['message'] == 'no such user or wrong password': + elif rep['status'] == "error" and rep['message'] == "no such user or wrong password": self.log_error(_("Wrong username or password")) return {'valid': False, 'premium': False} else: -- 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/FilecloudIo.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'module/plugins/accounts/FilecloudIo.py') diff --git a/module/plugins/accounts/FilecloudIo.py b/module/plugins/accounts/FilecloudIo.py index 021160f03..fb61e507c 100644 --- a/module/plugins/accounts/FilecloudIo.py +++ b/module/plugins/accounts/FilecloudIo.py @@ -16,11 +16,11 @@ class FilecloudIo(Account): ("stickell", "l.stickell@yahoo.it")] - def load_account_info(self, user, req): + def parse_info(self, user, password, data, req): #: It looks like the first API request always fails, so we retry 5 times, it should work on the second try for _i in xrange(5): rep = self.load("https://secure.filecloud.io/api-fetch_apikey.api", - post={'username': user, 'password': self.get_account_data(user)['password']}) + post={'username': user, 'password': self.get_data(user)['password']}) rep = json_loads(rep) if rep['status'] == "ok": break @@ -42,7 +42,7 @@ class FilecloudIo(Account): return {'premium': False} - def login(self, user, data, req): + def login(self, user, password, data, req): req.cj.setCookie("secure.filecloud.io", "lang", "en") html = self.load('https://secure.filecloud.io/user-login.html') @@ -50,10 +50,10 @@ class FilecloudIo(Account): self.form_data = {} self.form_data['username'] = user - self.form_data['password'] = data['password'] + self.form_password = password html = self.load('https://secure.filecloud.io/user-login_p.html', post=self.form_data) if "you have successfully logged in" not in html: - self.wrong_password() + self.fail() -- 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/FilecloudIo.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/accounts/FilecloudIo.py') diff --git a/module/plugins/accounts/FilecloudIo.py b/module/plugins/accounts/FilecloudIo.py index fb61e507c..56d84e2e4 100644 --- a/module/plugins/accounts/FilecloudIo.py +++ b/module/plugins/accounts/FilecloudIo.py @@ -20,7 +20,7 @@ class FilecloudIo(Account): #: It looks like the first API request always fails, so we retry 5 times, it should work on the second try for _i in xrange(5): rep = self.load("https://secure.filecloud.io/api-fetch_apikey.api", - post={'username': user, 'password': self.get_data(user)['password']}) + post={'username': user, 'password': password}) rep = json_loads(rep) if rep['status'] == "ok": break @@ -56,4 +56,4 @@ class FilecloudIo(Account): post=self.form_data) if "you have successfully logged in" not in html: - self.fail() + self.login_fail() -- cgit v1.2.3 From e5ce0acf056dc96c40d5616ab6d2b82f998eefbe Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 3 Aug 2015 00:37:57 +0200 Subject: Use set_cookie instead cj.setCookie --- module/plugins/accounts/FilecloudIo.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'module/plugins/accounts/FilecloudIo.py') diff --git a/module/plugins/accounts/FilecloudIo.py b/module/plugins/accounts/FilecloudIo.py index 56d84e2e4..bdb13bd3d 100644 --- a/module/plugins/accounts/FilecloudIo.py +++ b/module/plugins/accounts/FilecloudIo.py @@ -1,13 +1,14 @@ # -*- coding: utf-8 -*- -from module.plugins.internal.Account import Account from module.common.json_layer import json_loads +from module.plugins.internal.Account import Account +from module.plugins.internal.Plugin import set_cookie class FilecloudIo(Account): __name__ = "FilecloudIo" __type__ = "account" - __version__ = "0.06" + __version__ = "0.07" __status__ = "testing" __description__ = """FilecloudIo account plugin""" @@ -43,7 +44,7 @@ class FilecloudIo(Account): def login(self, user, password, data, req): - req.cj.setCookie("secure.filecloud.io", "lang", "en") + set_cookie(req.cj, "secure.filecloud.io", "lang", "en") html = self.load('https://secure.filecloud.io/user-login.html') if not hasattr(self, "form_data"): -- cgit v1.2.3