diff options
author | 2015-07-07 01:23:55 +0200 | |
---|---|---|
committer | 2015-07-07 01:23:55 +0200 | |
commit | b1759bc440cd6013837697eb8de540914f693ffd (patch) | |
tree | d170caf63d7f65e44d23ea2d91a65759a1665928 /module/plugins/hooks/ImageTyperz.py | |
parent | [Plugin] Fix decoding in load method (diff) | |
download | pyload-b1759bc440cd6013837697eb8de540914f693ffd.tar.xz |
No camelCase style anymore
Diffstat (limited to 'module/plugins/hooks/ImageTyperz.py')
-rw-r--r-- | module/plugins/hooks/ImageTyperz.py | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/module/plugins/hooks/ImageTyperz.py b/module/plugins/hooks/ImageTyperz.py index 90849a20c..c70518c17 100644 --- a/module/plugins/hooks/ImageTyperz.py +++ b/module/plugins/hooks/ImageTyperz.py @@ -17,7 +17,7 @@ class ImageTyperzException(Exception): self.err = err - def getCode(self): + def get_code(self): return self.err @@ -32,7 +32,7 @@ class ImageTyperzException(Exception): class ImageTyperz(Hook): __name__ = "ImageTyperz" __type__ = "hook" - __version__ = "0.07" + __version__ = "0.08" __config__ = [("username" , "str" , "Username" , "" ), ("password" , "password", "Password" , "" ), @@ -55,11 +55,11 @@ class ImageTyperz(Hook): self.info = {} #@TODO: Remove in 0.4.10 - def getCredits(self): + def get_credits(self): res = self.load(self.GETCREDITS_URL, post={'action': "REQUESTBALANCE", - 'username': self.getConfig('username'), - 'password': self.getConfig('password')}) + 'username': self.get_config('username'), + 'password': self.get_config('password')}) if res.startswith('ERROR'): raise ImageTyperzException(res) @@ -69,18 +69,18 @@ class ImageTyperz(Hook): except Exception: raise ImageTyperzException("Invalid response") - self.logInfo(_("Account balance: $%s left") % res) + self.log_info(_("Account balance: $%s left") % res) return balance def submit(self, captcha, captchaType="file", match=None): req = getRequest() - #raise timeout threshold + # raise timeout threshold req.c.setopt(pycurl.LOW_SPEED_TIME, 80) try: #@NOTE: Workaround multipart-post bug in HTTPRequest.py - if re.match("^\w*$", self.getConfig('password')): + if re.match("^\w*$", self.get_config('password')): multipart = True data = (pycurl.FORM_FILE, captcha) else: @@ -91,8 +91,8 @@ class ImageTyperz(Hook): res = self.load(self.SUBMIT_URL, post={'action': "UPLOADCAPTCHA", - 'username': self.getConfig('username'), - 'password': self.getConfig('password'), "file": data}, + 'username': self.get_config('username'), + 'password': self.get_config('password'), "file": data}, multipart=multipart, req=req) finally: @@ -117,38 +117,38 @@ class ImageTyperz(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() > 0: + if self.get_credits() > 0: task.handler.append(self) task.data['service'] = self.__name__ task.setWaiting(100) - self._processCaptcha(task) + self._process_captcha(task) else: - self.logInfo(_("Your %s account has not enough credits") % self.__name__) + self.log_info(_("Your %s account has not enough credits") % self.__name__) def captcha_invalid(self, task): if task.data['service'] == self.__name__ and "ticket" in task.data: res = self.load(self.RESPOND_URL, post={'action': "SETBADIMAGE", - 'username': self.getConfig('username'), - 'password': self.getConfig('password'), + 'username': self.get_config('username'), + 'password': self.get_config('password'), 'imageid': task.data['ticket']}) if res == "SUCCESS": - self.logInfo(_("Bad captcha solution received, requested refund")) + self.log_info(_("Bad captcha solution received, requested refund")) else: - self.logError(_("Bad captcha solution received, refund request failed"), res) + self.log_error(_("Bad captcha solution received, refund request failed"), res) @threaded - def _processCaptcha(self, task): + def _process_captcha(self, task): c = task.captchaFile try: ticket, result = self.submit(c) |