diff options
| author | 2014-10-22 19:44:59 +0200 | |
|---|---|---|
| committer | 2014-10-22 19:47:17 +0200 | |
| commit | 0eb6e7ec4a1144dcca824d8add049787d3da1762 (patch) | |
| tree | d653f5fe28bb247a3c4fadeca9bf6278d744f929 /module/plugins/hooks/DeathByCaptcha.py | |
| parent | Spare code cosmetics (diff) | |
| download | pyload-0eb6e7ec4a1144dcca824d8add049787d3da1762.tar.xz | |
Two space before function declaration
Diffstat (limited to 'module/plugins/hooks/DeathByCaptcha.py')
| -rw-r--r-- | module/plugins/hooks/DeathByCaptcha.py | 12 | 
1 files changed, 12 insertions, 0 deletions
| diff --git a/module/plugins/hooks/DeathByCaptcha.py b/module/plugins/hooks/DeathByCaptcha.py index 2548506cb..99d7f7401 100644 --- a/module/plugins/hooks/DeathByCaptcha.py +++ b/module/plugins/hooks/DeathByCaptcha.py @@ -25,21 +25,26 @@ class DeathByCaptchaException(Exception):                    'invalid-request': 'Invalid request',                    'timed-out': 'No CAPTCHA solution received in time'} +      def __init__(self, err):          self.err = err +      def getCode(self):          return self.err +      def getDesc(self):          if self.err in self.DBC_ERRORS.keys():              return self.DBC_ERRORS[self.err]          else:              return self.err +      def __str__(self):          return "<DeathByCaptchaException %s>" % self.err +      def __repr__(self):          return "<DeathByCaptchaException %s>" % self.err @@ -66,6 +71,7 @@ class DeathByCaptcha(Hook):      def setup(self):          self.info = {} +      def call_api(self, api="captcha", post=False, multipart=False):          req = getRequest()          req.c.setopt(HTTPHEADER, ["Accept: application/json", "User-Agent: pyLoad %s" % self.core.version]) @@ -106,6 +112,7 @@ class DeathByCaptcha(Hook):          return response +      def getCredits(self):          response = self.call_api("user", True) @@ -116,12 +123,14 @@ class DeathByCaptcha(Hook):          else:              raise DeathByCaptchaException(response) +      def getStatus(self):          response = self.call_api("status", False)          if 'is_service_overloaded' in response and response['is_service_overloaded']:              raise DeathByCaptchaException('service-overload') +      def submit(self, captcha, captchaType="file", match=None):          #workaround multipart-post bug in HTTPRequest.py          if re.match("^\w*$", self.getConfig("passkey")): @@ -152,6 +161,7 @@ class DeathByCaptcha(Hook):          return ticket, result +      def newCaptchaTask(self, task):          if "service" in task.data:              return False @@ -183,6 +193,7 @@ class DeathByCaptcha(Hook):              task.setWaiting(180)              start_new_thread(self.processCaptcha, (task,)) +      def captchaInvalid(self, task):          if task.data['service'] == self.__name__ and "ticket" in task.data:              try: @@ -192,6 +203,7 @@ class DeathByCaptcha(Hook):              except Exception, e:                  self.logError(e) +      def processCaptcha(self, task):          c = task.captchaFile          try: | 
