diff options
author | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-12-14 03:44:18 +0100 |
---|---|---|
committer | Walter Purcaro <vuolter@users.noreply.github.com> | 2015-12-27 20:53:53 +0100 |
commit | 48c743058bd280d62d2aa9f2db56d894b502a8d9 (patch) | |
tree | c7134030736d3361463bfa92cf06979dcdab2ceb /module/plugins/hooks/DeathByCaptcha.py | |
parent | Rename IRC and XMPP addon plugins (diff) | |
download | pyload-48c743058bd280d62d2aa9f2db56d894b502a8d9.tar.xz |
Update addons
Diffstat (limited to 'module/plugins/hooks/DeathByCaptcha.py')
-rw-r--r-- | module/plugins/hooks/DeathByCaptcha.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/module/plugins/hooks/DeathByCaptcha.py b/module/plugins/hooks/DeathByCaptcha.py index 5c1c89c88..bce13f0fa 100644 --- a/module/plugins/hooks/DeathByCaptcha.py +++ b/module/plugins/hooks/DeathByCaptcha.py @@ -2,16 +2,16 @@ from __future__ import with_statement -import pycurl +import base64 import re import time -from base64 import b64encode +import pycurl -from module.plugins.internal.utils import json from module.network.HTTPRequest import BadHeader from module.network.RequestFactory import getRequest as get_request -from module.plugins.internal.Addon import Addon, threaded +from module.plugins.internal.Addon import Addon +from module.plugins.internal.misc import json, threaded class DeathByCaptchaException(Exception): @@ -51,7 +51,7 @@ class DeathByCaptchaException(Exception): class DeathByCaptcha(Addon): __name__ = "DeathByCaptcha" __type__ = "hook" - __version__ = "0.10" + __version__ = "0.11" __status__ = "testing" __config__ = [("activated" , "bool" , "Activated" , False), @@ -75,8 +75,8 @@ class DeathByCaptcha(Addon): if post: if not isinstance(post, dict): post = {} - post.update({'username': self.get_config('username'), - 'password': self.get_config('password')}) + post.update({'username': self.config.get('username'), + 'password': self.config.get('password')}) res = None try: @@ -135,14 +135,14 @@ class DeathByCaptcha(Addon): def submit(self, captcha, captchaType="file", match=None): #@NOTE: Workaround multipart-post bug in HTTPRequest.py - if re.match("^\w*$", self.get_config('password')): + if re.match("^\w*$", self.config.get('password')): multipart = True data = (pycurl.FORM_FILE, captcha) else: multipart = False with open(captcha, 'rb') as f: data = f.read() - data = "base64:" + b64encode(data) + data = "base64:" + base64.b64encode(data) res = self.api_response("captcha", {'captchafile': data}, multipart) @@ -171,10 +171,10 @@ class DeathByCaptcha(Addon): if not task.isTextual(): return False - if not self.get_config('username') or not self.get_config('password'): + if not self.config.get('username') or not self.config.get('password'): return False - if self.pyload.isClientConnected() and self.get_config('check_client'): + if self.pyload.isClientConnected() and self.config.get('check_client'): return False try: @@ -209,7 +209,7 @@ class DeathByCaptcha(Addon): @threaded - def _process_captcha(self, task): + def _process_captcha(self, task) c = task.captchaFile try: ticket, result = self.submit(c) |