summaryrefslogtreecommitdiffstats
path: root/module/plugins/hooks/CaptchaBrotherhood.py
diff options
context:
space:
mode:
Diffstat (limited to 'module/plugins/hooks/CaptchaBrotherhood.py')
-rw-r--r--module/plugins/hooks/CaptchaBrotherhood.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/module/plugins/hooks/CaptchaBrotherhood.py b/module/plugins/hooks/CaptchaBrotherhood.py
index 3157fead8..da8fcbafe 100644
--- a/module/plugins/hooks/CaptchaBrotherhood.py
+++ b/module/plugins/hooks/CaptchaBrotherhood.py
@@ -23,12 +23,15 @@ class CaptchaBrotherhoodException(Exception):
def __init__(self, err):
self.err = err
+
def getCode(self):
return self.err
+
def __str__(self):
return "<CaptchaBrotherhoodException %s>" % self.err
+
def __repr__(self):
return "<CaptchaBrotherhoodException %s>" % self.err
@@ -55,6 +58,7 @@ class CaptchaBrotherhood(Hook):
def setup(self):
self.info = {}
+
def getCredits(self):
response = getURL(self.API_URL + "askCredits.aspx",
get={"username": self.getConfig("username"), "password": self.getConfig("passkey")})
@@ -66,6 +70,7 @@ class CaptchaBrotherhood(Hook):
self.info['credits'] = credits
return credits
+
def submit(self, captcha, captchaType="file", match=None):
try:
img = Image.open(captcha)
@@ -116,6 +121,7 @@ class CaptchaBrotherhood(Hook):
raise CaptchaBrotherhoodException("No solution received in time")
+
def get_api(self, api, ticket):
response = getURL("%s%s.aspx" % (self.API_URL, api),
get={"username": self.getConfig("username"),
@@ -126,6 +132,7 @@ class CaptchaBrotherhood(Hook):
return response
+
def newCaptchaTask(self, task):
if "service" in task.data:
return False
@@ -147,10 +154,12 @@ class CaptchaBrotherhood(Hook):
else:
self.logInfo(_("Your CaptchaBrotherhood Account has not enough credits"))
+
def captchaInvalid(self, task):
if task.data['service'] == self.__name__ and "ticket" in task.data:
response = self.get_api("complainCaptcha", task.data['ticket'])
+
def processCaptcha(self, task):
c = task.captchaFile
try: