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/hooks/CaptchaBrotherhood.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks/CaptchaBrotherhood.py') diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py index bda080037..6dbb67335 100644 --- a/module/plugins/hooks/CaptchaBrotherhood.py +++ b/module/plugins/hooks/CaptchaBrotherhood.py @@ -13,7 +13,7 @@ except ImportError: import Image from module.network.RequestFactory import getURL, getRequest -from module.plugins.Hook import Hook, threaded +from module.plugins.internal.Hook import Hook, threaded class CaptchaBrotherhoodException(Exception): @@ -37,7 +37,7 @@ class CaptchaBrotherhoodException(Exception): class CaptchaBrotherhood(Hook): __name__ = "CaptchaBrotherhood" __type__ = "hook" - __version__ = "0.08" + __version__ = "0.09" __config__ = [("username", "str", "Username", ""), ("force", "bool", "Force CT even if client is connected", False), -- cgit v1.2.3 From f4b893e5ee24769584a2da1866c665489f7019ec Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 15 Jun 2015 06:56:13 +0200 Subject: Hook plugin code cosmetics --- module/plugins/hooks/CaptchaBrotherhood.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks/CaptchaBrotherhood.py') diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py index 6dbb67335..eecf49515 100644 --- a/module/plugins/hooks/CaptchaBrotherhood.py +++ b/module/plugins/hooks/CaptchaBrotherhood.py @@ -132,7 +132,7 @@ class CaptchaBrotherhood(Hook): return res - def newCaptchaTask(self, task): + def captcha_task(self, task): if "service" in task.data: return False -- cgit v1.2.3 From 5a139055ae658d3a05cbb658cbd66aeae0d01db5 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Mon, 15 Jun 2015 21:06:10 +0200 Subject: Spare code cosmetics --- module/plugins/hooks/CaptchaBrotherhood.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks/CaptchaBrotherhood.py') diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py index eecf49515..1f2bbf956 100644 --- a/module/plugins/hooks/CaptchaBrotherhood.py +++ b/module/plugins/hooks/CaptchaBrotherhood.py @@ -154,7 +154,7 @@ class CaptchaBrotherhood(Hook): self.logInfo(_("Your CaptchaBrotherhood Account has not enough credits")) - def captchaInvalid(self, task): + def captcha_invalid(self, task): if task.data['service'] == self.__name__ and "ticket" in task.data: res = self.api_response("complainCaptcha", task.data['ticket']) -- 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/hooks/CaptchaBrotherhood.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'module/plugins/hooks/CaptchaBrotherhood.py') diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py index 1f2bbf956..3992c6ca7 100644 --- a/module/plugins/hooks/CaptchaBrotherhood.py +++ b/module/plugins/hooks/CaptchaBrotherhood.py @@ -12,7 +12,7 @@ try: except ImportError: import Image -from module.network.RequestFactory import getURL, getRequest +from module.network.RequestFactory import getRequest from module.plugins.internal.Hook import Hook, threaded @@ -59,7 +59,7 @@ class CaptchaBrotherhood(Hook): def getCredits(self): - res = getURL(self.API_URL + "askCredits.aspx", + res = self.load(self.API_URL + "askCredits.aspx", get={"username": self.getConfig('username'), "password": self.getConfig('passkey')}) if not res.startswith("OK"): raise CaptchaBrotherhoodException(res) @@ -122,7 +122,7 @@ class CaptchaBrotherhood(Hook): def api_response(self, api, ticket): - res = getURL("%s%s.aspx" % (self.API_URL, api), + res = self.load("%s%s.aspx" % (self.API_URL, api), get={"username": self.getConfig('username'), "password": self.getConfig('passkey'), "captchaID": ticket}) -- cgit v1.2.3 From e4fb45b22d36595839e8f638a3f0a4669dba3e8d Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 21 Jun 2015 08:50:26 +0200 Subject: Spare code cosmetics (4) --- module/plugins/hooks/CaptchaBrotherhood.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'module/plugins/hooks/CaptchaBrotherhood.py') diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py index 3992c6ca7..070d92da8 100644 --- a/module/plugins/hooks/CaptchaBrotherhood.py +++ b/module/plugins/hooks/CaptchaBrotherhood.py @@ -39,9 +39,9 @@ class CaptchaBrotherhood(Hook): __type__ = "hook" __version__ = "0.09" - __config__ = [("username", "str", "Username", ""), - ("force", "bool", "Force CT even if client is connected", False), - ("passkey", "password", "Password", "")] + __config__ = [("username" , "str" , "Username" , "" ), + ("password" , "password", "Password" , "" ), + ("check_client", "bool" , "Don't use if client is connected", True)] __description__ = """Send captchas to CaptchaBrotherhood.com""" __license__ = "GPLv3" @@ -60,7 +60,7 @@ class CaptchaBrotherhood(Hook): def getCredits(self): res = self.load(self.API_URL + "askCredits.aspx", - get={"username": self.getConfig('username'), "password": self.getConfig('passkey')}) + get={"username": self.getConfig('username'), "password": self.getConfig('password')}) if not res.startswith("OK"): raise CaptchaBrotherhoodException(res) else: @@ -90,7 +90,7 @@ class CaptchaBrotherhood(Hook): url = "%ssendNewCaptcha.aspx?%s" % (self.API_URL, urllib.urlencode({'username' : self.getConfig('username'), - 'password' : self.getConfig('passkey'), + 'password' : self.getConfig('password'), 'captchaSource': "pyLoad", 'timeout' : "80"})) @@ -124,7 +124,7 @@ class CaptchaBrotherhood(Hook): def api_response(self, api, ticket): res = self.load("%s%s.aspx" % (self.API_URL, api), get={"username": self.getConfig('username'), - "password": self.getConfig('passkey'), + "password": self.getConfig('password'), "captchaID": ticket}) if not res.startswith("OK"): raise CaptchaBrotherhoodException("Unknown response: %s" % res) @@ -139,10 +139,10 @@ class CaptchaBrotherhood(Hook): if not task.isTextual(): return False - if not self.getConfig('username') or not self.getConfig('passkey'): + if not self.getConfig('username') or not self.getConfig('password'): return False - if self.core.isClientConnected() and not self.getConfig('force'): + if self.core.isClientConnected() and self.getConfig('check_client'): return False if self.getCredits() > 10: -- 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/hooks/CaptchaBrotherhood.py | 32 +++++++++++++++--------------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'module/plugins/hooks/CaptchaBrotherhood.py') diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py index 070d92da8..b2f370f32 100644 --- a/module/plugins/hooks/CaptchaBrotherhood.py +++ b/module/plugins/hooks/CaptchaBrotherhood.py @@ -22,7 +22,7 @@ class CaptchaBrotherhoodException(Exception): self.err = err - def getCode(self): + def get_code(self): return self.err @@ -37,7 +37,7 @@ class CaptchaBrotherhoodException(Exception): class CaptchaBrotherhood(Hook): __name__ = "CaptchaBrotherhood" __type__ = "hook" - __version__ = "0.09" + __version__ = "0.10" __config__ = [("username" , "str" , "Username" , "" ), ("password" , "password", "Password" , "" ), @@ -58,14 +58,14 @@ class CaptchaBrotherhood(Hook): self.info = {} #@TODO: Remove in 0.4.10 - def getCredits(self): + def get_credits(self): res = self.load(self.API_URL + "askCredits.aspx", - get={"username": self.getConfig('username'), "password": self.getConfig('password')}) + get={"username": self.get_config('username'), "password": self.get_config('password')}) if not res.startswith("OK"): raise CaptchaBrotherhoodException(res) else: credits = int(res[3:]) - self.logInfo(_("%d credits left") % credits) + self.log_info(_("%d credits left") % credits) self.info['credits'] = credits return credits @@ -74,7 +74,7 @@ class CaptchaBrotherhood(Hook): try: img = Image.open(captcha) output = StringIO.StringIO() - self.logDebug("CAPTCHA IMAGE", img, img.format, img.mode) + self.log_debug("CAPTCHA IMAGE", img, img.format, img.mode) if img.format in ("GIF", "JPEG"): img.save(output, img.format) else: @@ -89,8 +89,8 @@ class CaptchaBrotherhood(Hook): req = getRequest() url = "%ssendNewCaptcha.aspx?%s" % (self.API_URL, - urllib.urlencode({'username' : self.getConfig('username'), - 'password' : self.getConfig('password'), + urllib.urlencode({'username' : self.get_config('username'), + 'password' : self.get_config('password'), 'captchaSource': "pyLoad", 'timeout' : "80"})) @@ -123,8 +123,8 @@ class CaptchaBrotherhood(Hook): def api_response(self, api, ticket): res = self.load("%s%s.aspx" % (self.API_URL, api), - get={"username": self.getConfig('username'), - "password": self.getConfig('password'), + get={"username": self.get_config('username'), + "password": self.get_config('password'), "captchaID": ticket}) if not res.startswith("OK"): raise CaptchaBrotherhoodException("Unknown response: %s" % res) @@ -139,19 +139,19 @@ class CaptchaBrotherhood(Hook): if not task.isTextual(): return False - if not self.getConfig('username') or not self.getConfig('password'): + if not self.get_config('username') or not self.get_config('password'): return False - if self.core.isClientConnected() and self.getConfig('check_client'): + if self.core.isClientConnected() and self.get_config('check_client'): return False - if self.getCredits() > 10: + if self.get_credits() > 10: task.handler.append(self) task.data['service'] = self.__name__ task.setWaiting(100) - self._processCaptcha(task) + self._process_captcha(task) else: - self.logInfo(_("Your CaptchaBrotherhood Account has not enough credits")) + self.log_info(_("Your CaptchaBrotherhood Account has not enough credits")) def captcha_invalid(self, task): @@ -160,7 +160,7 @@ class CaptchaBrotherhood(Hook): @threaded - def _processCaptcha(self, task): + def _process_captcha(self, task): c = task.captchaFile try: ticket, result = self.submit(c) -- cgit v1.2.3 From 9e5d813d7721e351ac02ba72bdc473a7d77ba6b7 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sat, 18 Jul 2015 20:04:36 +0200 Subject: Code cosmetics --- module/plugins/hooks/CaptchaBrotherhood.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'module/plugins/hooks/CaptchaBrotherhood.py') diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py index b2f370f32..d35bc720d 100644 --- a/module/plugins/hooks/CaptchaBrotherhood.py +++ b/module/plugins/hooks/CaptchaBrotherhood.py @@ -9,10 +9,11 @@ import urllib try: from PIL import Image + except ImportError: import Image -from module.network.RequestFactory import getRequest +from module.network.RequestFactory import getRequest as get_request from module.plugins.internal.Hook import Hook, threaded @@ -86,7 +87,7 @@ class CaptchaBrotherhood(Hook): except Exception, e: raise CaptchaBrotherhoodException("Reading or converting captcha image failed: %s" % e) - req = getRequest() + req = get_request() url = "%ssendNewCaptcha.aspx?%s" % (self.API_URL, urllib.urlencode({'username' : self.get_config('username'), -- cgit v1.2.3 From 502517f37c7540b0bddb092e69386d9d6f08800c Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Jul 2015 09:42:34 +0200 Subject: Fix addons --- module/plugins/hooks/CaptchaBrotherhood.py | 6 ------ 1 file changed, 6 deletions(-) (limited to 'module/plugins/hooks/CaptchaBrotherhood.py') diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py index d35bc720d..1265fc0ae 100644 --- a/module/plugins/hooks/CaptchaBrotherhood.py +++ b/module/plugins/hooks/CaptchaBrotherhood.py @@ -50,15 +50,9 @@ class CaptchaBrotherhood(Hook): ("zoidberg", "zoidberg@mujmail.cz")] - interval = 0 #@TODO: Remove in 0.4.10 - API_URL = "http://www.captchabrotherhood.com/" - def setup(self): - self.info = {} #@TODO: Remove in 0.4.10 - - def get_credits(self): res = self.load(self.API_URL + "askCredits.aspx", get={"username": self.get_config('username'), "password": self.get_config('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/hooks/CaptchaBrotherhood.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'module/plugins/hooks/CaptchaBrotherhood.py') diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py index 1265fc0ae..1660e2059 100644 --- a/module/plugins/hooks/CaptchaBrotherhood.py +++ b/module/plugins/hooks/CaptchaBrotherhood.py @@ -55,7 +55,7 @@ class CaptchaBrotherhood(Hook): def get_credits(self): res = self.load(self.API_URL + "askCredits.aspx", - get={"username": self.get_config('username'), "password": self.get_config('password')}) + get={'username': self.get_config('username'), 'password': self.get_config('password')}) if not res.startswith("OK"): raise CaptchaBrotherhoodException(res) else: @@ -118,9 +118,9 @@ class CaptchaBrotherhood(Hook): def api_response(self, api, ticket): res = self.load("%s%s.aspx" % (self.API_URL, api), - get={"username": self.get_config('username'), - "password": self.get_config('password'), - "captchaID": ticket}) + get={'username': self.get_config('username'), + 'password': self.get_config('password'), + 'captchaID': ticket}) if not res.startswith("OK"): raise CaptchaBrotherhoodException("Unknown response: %s" % res) -- cgit v1.2.3 From 56389e28ba5d2f5658278bc7f486d73be747f135 Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Sun, 19 Jul 2015 11:44:49 +0200 Subject: Rename self.core to self.pyload (plugins only) --- module/plugins/hooks/CaptchaBrotherhood.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks/CaptchaBrotherhood.py') diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py index 1660e2059..946ee2372 100644 --- a/module/plugins/hooks/CaptchaBrotherhood.py +++ b/module/plugins/hooks/CaptchaBrotherhood.py @@ -137,7 +137,7 @@ class CaptchaBrotherhood(Hook): if not self.get_config('username') or not self.get_config('password'): return False - if self.core.isClientConnected() and self.get_config('check_client'): + if self.pyload.isClientConnected() and self.get_config('check_client'): return False if self.get_credits() > 10: -- 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/hooks/CaptchaBrotherhood.py | 1 + 1 file changed, 1 insertion(+) (limited to 'module/plugins/hooks/CaptchaBrotherhood.py') diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py index 946ee2372..017e0952d 100644 --- a/module/plugins/hooks/CaptchaBrotherhood.py +++ b/module/plugins/hooks/CaptchaBrotherhood.py @@ -39,6 +39,7 @@ class CaptchaBrotherhood(Hook): __name__ = "CaptchaBrotherhood" __type__ = "hook" __version__ = "0.10" + __status__ = "stable" __config__ = [("username" , "str" , "Username" , "" ), ("password" , "password", "Password" , "" ), -- 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/hooks/CaptchaBrotherhood.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks/CaptchaBrotherhood.py') diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py index 017e0952d..cc85f8660 100644 --- a/module/plugins/hooks/CaptchaBrotherhood.py +++ b/module/plugins/hooks/CaptchaBrotherhood.py @@ -39,7 +39,7 @@ class CaptchaBrotherhood(Hook): __name__ = "CaptchaBrotherhood" __type__ = "hook" __version__ = "0.10" - __status__ = "stable" + __status__ = "testing" __config__ = [("username" , "str" , "Username" , "" ), ("password" , "password", "Password" , "" ), -- 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/hooks/CaptchaBrotherhood.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks/CaptchaBrotherhood.py') diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py index cc85f8660..42a9a26d9 100644 --- a/module/plugins/hooks/CaptchaBrotherhood.py +++ b/module/plugins/hooks/CaptchaBrotherhood.py @@ -151,7 +151,7 @@ class CaptchaBrotherhood(Hook): def captcha_invalid(self, task): - if task.data['service'] == self.__name__ and "ticket" in task.data: + if task.data['service'] is self.__name__ and "ticket" in task.data: res = self.api_response("complainCaptcha", task.data['ticket']) -- cgit v1.2.3 From 88f98ab3bd6e091c1b6ca6ac9fddc37b2e29694c Mon Sep 17 00:00:00 2001 From: Walter Purcaro Date: Thu, 30 Jul 2015 14:37:44 +0200 Subject: Fix get_code call in captcha hooks --- module/plugins/hooks/CaptchaBrotherhood.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'module/plugins/hooks/CaptchaBrotherhood.py') diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py index 42a9a26d9..0df1ab8a9 100644 --- a/module/plugins/hooks/CaptchaBrotherhood.py +++ b/module/plugins/hooks/CaptchaBrotherhood.py @@ -161,7 +161,7 @@ class CaptchaBrotherhood(Hook): try: ticket, result = self.submit(c) except CaptchaBrotherhoodException, e: - task.error = e.getCode() + task.error = e.get_code() return task.data['ticket'] = ticket -- cgit v1.2.3