diff options
author | Walter Purcaro <vuolter@gmail.com> | 2014-10-22 19:44:59 +0200 |
---|---|---|
committer | Walter Purcaro <vuolter@gmail.com> | 2014-10-22 19:47:17 +0200 |
commit | 0eb6e7ec4a1144dcca824d8add049787d3da1762 (patch) | |
tree | d653f5fe28bb247a3c4fadeca9bf6278d744f929 /module/plugins/hooks/BypassCaptcha.py | |
parent | Spare code cosmetics (diff) | |
download | pyload-0eb6e7ec4a1144dcca824d8add049787d3da1762.tar.xz |
Two space before function declaration
Diffstat (limited to 'module/plugins/hooks/BypassCaptcha.py')
-rw-r--r-- | module/plugins/hooks/BypassCaptcha.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/module/plugins/hooks/BypassCaptcha.py b/module/plugins/hooks/BypassCaptcha.py index 984aac919..a07b2fc66 100644 --- a/module/plugins/hooks/BypassCaptcha.py +++ b/module/plugins/hooks/BypassCaptcha.py @@ -13,12 +13,15 @@ class BypassCaptchaException(Exception): def __init__(self, err): self.err = err + def getCode(self): return self.err + def __str__(self): return "<BypassCaptchaException %s>" % self.err + def __repr__(self): return "<BypassCaptchaException %s>" % self.err @@ -49,12 +52,14 @@ class BypassCaptcha(Hook): def setup(self): self.info = {} + def getCredits(self): response = getURL(self.GETCREDITS_URL, post={"key": self.getConfig("passkey")}) data = dict([x.split(' ', 1) for x in response.splitlines()]) return int(data['Left']) + def submit(self, captcha, captchaType="file", match=None): req = getRequest() @@ -81,6 +86,7 @@ class BypassCaptcha(Hook): return ticket, result + def respond(self, ticket, success): try: response = getURL(self.RESPOND_URL, post={"task_id": ticket, "key": self.getConfig("passkey"), @@ -88,6 +94,7 @@ class BypassCaptcha(Hook): except BadHeader, e: self.logError(_("Could not send response."), e + def newCaptchaTask(self, task): if "service" in task.data: return False @@ -110,14 +117,17 @@ class BypassCaptcha(Hook): else: self.logInfo(_("Your %s account has not enough credits") % self.__name__) + def captchaCorrect(self, task): if task.data['service'] == self.__name__ and "ticket" in task.data: self.respond(task.data['ticket'], True) + def captchaInvalid(self, task): if task.data['service'] == self.__name__ and "ticket" in task.data: self.respond(task.data['ticket'], False) + def processCaptcha(self, task): c = task.captchaFile try: |