diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-12-11 18:16:31 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-12-11 18:16:31 +0100 |
commit | 5d5b7124582d897eacf15defc50bafa7d3aca0fa (patch) | |
tree | 04d2a16be8267a868ffcdb1522afee5118f0592a /module | |
parent | little test cases (diff) | |
download | pyload-5d5b7124582d897eacf15defc50bafa7d3aca0fa.tar.xz |
closed #455
Diffstat (limited to 'module')
-rw-r--r-- | module/plugins/hooks/CaptchaTrader.py | 14 |
1 files changed, 10 insertions, 4 deletions
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(): |