From 5d5b7124582d897eacf15defc50bafa7d3aca0fa Mon Sep 17 00:00:00 2001 From: RaNaN Date: Sun, 11 Dec 2011 18:16:31 +0100 Subject: closed #455 --- module/plugins/hooks/CaptchaTrader.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'module/plugins/hooks') diff --git a/module/plugins/hooks/CaptchaTrader.py b/module/plugins/hooks/CaptchaTrader.py index a0e8a0453..889eb83c0 100644 --- a/module/plugins/hooks/CaptchaTrader.py +++ b/module/plugins/hooks/CaptchaTrader.py @@ -25,6 +25,7 @@ from thread import start_new_thread from pycurl import FORM_FILE, LOW_SPEED_TIME from module.network.RequestFactory import getURL, getRequest +from module.network.HTTPRequest import BadHeader from module.plugins.Hook import Hook @@ -105,13 +106,18 @@ class CaptchaTrader(Hook): return ticket, result def respond(self, ticket, success): - json = getURL(CaptchaTrader.RESPOND_URL, post={"is_correct": 1 if success else 0, + try: + json = getURL(CaptchaTrader.RESPOND_URL, post={"is_correct": 1 if success else 0, "username": self.getConfig("username"), "password": self.getConfig("passkey"), "ticket": ticket}) - response = loads(json) - if response[0] < 0: - raise CaptchaTraderException(response[1]) + + response = loads(json) + if response[0] < 0: + raise CaptchaTraderException(response[1]) + + except BadHeader, e: + self.logError(_("Could not send response."), str(e)) def newCaptchaTask(self, task): if not task.isTextual(): -- cgit v1.2.3