diff options
Diffstat (limited to 'module/plugins/hooks/Captcha9Kw.py')
-rw-r--r-- | module/plugins/hooks/Captcha9Kw.py | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/module/plugins/hooks/Captcha9Kw.py b/module/plugins/hooks/Captcha9Kw.py index c81882f67..714be8bc4 100644 --- a/module/plugins/hooks/Captcha9Kw.py +++ b/module/plugins/hooks/Captcha9Kw.py @@ -2,11 +2,10 @@ from __future__ import with_statement +import base64 import re import time -from base64 import b64encode - from module.network.HTTPRequest import BadHeader from module.plugins.internal.Addon import Addon, threaded @@ -14,7 +13,7 @@ from module.plugins.internal.Addon import Addon, threaded class Captcha9Kw(Addon): __name__ = "Captcha9Kw" __type__ = "hook" - __version__ = "0.31" + __version__ = "0.32" __status__ = "testing" __config__ = [("activated" , "bool" , "Activated" , False ), @@ -40,7 +39,7 @@ class Captcha9Kw(Addon): def get_credits(self): res = self.load(self.API_URL, - get={'apikey': self.get_config('passkey'), + get={'apikey': self.config.get('passkey'), 'pyload': "1", 'source': "pyload", 'action': "usercaptchaguthaben"}) @@ -71,14 +70,14 @@ class Captcha9Kw(Addon): 'numeric' : 0, 'case_sensitive': 0, 'math' : 0, - 'prio' : min(max(self.get_config('prio'), 0), 10), - 'confirm' : self.get_config('confirm'), - 'timeout' : min(max(self.get_config('timeout'), 300), 3999), - 'selfsolve' : self.get_config('selfsolve'), - 'cph' : self.get_config('captchaperhour'), - 'cpm' : self.get_config('captchapermin')} - - for opt in str(self.get_config('hoster_options').split('|')): + 'prio' : min(max(self.config.get('prio'), 0), 10), + 'confirm' : self.config.get('confirm'), + 'timeout' : min(max(self.config.get('timeout'), 300), 3999), + 'selfsolve' : self.config.get('selfsolve'), + 'cph' : self.config.get('captchaperhour'), + 'cpm' : self.config.get('captchapermin')} + + for opt in str(self.config.get('hoster_options').split('|')): details = map(str.strip, opt.split(':')) if not details or details[0].lower() is not pluginname.lower(): @@ -96,7 +95,7 @@ class Captcha9Kw(Addon): break - post_data = {'apikey' : self.get_config('passkey'), + post_data = {'apikey' : self.config.get('passkey'), 'prio' : option['prio'], 'confirm' : option['confirm'], 'maxtimeout' : option['timeout'], @@ -114,7 +113,7 @@ class Captcha9Kw(Addon): 'source' : "pyload", 'base64' : 1, 'mouse' : 1 if task.isPositional() else 0, - 'file-upload-01': b64encode(data), + 'file-upload-01': base64.b64encode(data), 'action' : "usercaptchaupload"} for _i in xrange(5): @@ -136,9 +135,9 @@ class Captcha9Kw(Addon): task.data['ticket'] = res - for _i in xrange(int(self.get_config('timeout') / 5)): + for _i in xrange(int(self.config.get('timeout') / 5)): result = self.load(self.API_URL, - get={'apikey': self.get_config('passkey'), + get={'apikey': self.config.get('passkey'), 'id' : res, 'pyload': "1", 'info' : "1", @@ -163,10 +162,10 @@ class Captcha9Kw(Addon): if not task.isTextual() and not task.isPositional(): return - if not self.get_config('passkey'): + if not self.config.get('passkey'): return - if self.pyload.isClientConnected() and self.get_config('check_client'): + if self.pyload.isClientConnected() and self.config.get('check_client'): return credits = self.get_credits() @@ -175,8 +174,8 @@ class Captcha9Kw(Addon): self.log_error(_("Your captcha 9kw.eu account has not enough credits")) return - queue = min(self.get_config('queue'), 999) - timeout = min(max(self.get_config('timeout'), 300), 3999) + queue = min(self.config.get('queue'), 999) + timeout = min(max(self.config.get('timeout'), 300), 3999) pluginname = re.search(r'_(.+?)_\d+.\w+', task.captchaFile).group(1) for _i in xrange(5): @@ -189,7 +188,7 @@ class Captcha9Kw(Addon): else: self.fail(_("Too many captchas in queue")) - for opt in str(self.get_config('hoster_options').split('|')): + for opt in str(self.config.get('hoster_options').split('|')): details = map(str.strip, opt.split(':')) if not details or details[0].lower() is not pluginname.lower(): @@ -219,7 +218,7 @@ class Captcha9Kw(Addon): self.log_debug("No CaptchaID for %s request (task: %s)" % (type, task)) return - passkey = self.get_config('passkey') + passkey = self.config.get('passkey') for _i in xrange(3): res = self.load(self.API_URL, |