diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-06-27 20:27:38 +0200 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2011-06-27 20:27:38 +0200 |
commit | 06d6f4ffda1b1542d9345f246f1c9645d96aeec0 (patch) | |
tree | 34a414c9170254ae6e886668a440a1a37d228de8 /module/plugins/hooks/CaptchaTrader.py | |
parent | Shareonline, zshare fix, testing __slots__ attribute (diff) | |
download | pyload-06d6f4ffda1b1542d9345f246f1c9645d96aeec0.tar.xz |
closed #345
Diffstat (limited to 'module/plugins/hooks/CaptchaTrader.py')
-rw-r--r-- | module/plugins/hooks/CaptchaTrader.py | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/module/plugins/hooks/CaptchaTrader.py b/module/plugins/hooks/CaptchaTrader.py index af6626897..2bae9401a 100644 --- a/module/plugins/hooks/CaptchaTrader.py +++ b/module/plugins/hooks/CaptchaTrader.py @@ -22,9 +22,9 @@ except ImportError: from simplejson import loads from thread import start_new_thread -from pycurl import FORM_FILE +from pycurl import FORM_FILE, LOW_SPEED_TIME -from module.network.RequestFactory import getURL +from module.network.RequestFactory import getURL, getRequest from module.plugins.Hook import Hook @@ -45,7 +45,7 @@ class CaptchaTraderException(Exception): class CaptchaTrader(Hook): __name__ = "CaptchaTrader" - __version__ = "0.11" + __version__ = "0.12" __description__ = """send captchas to captchatrader.com""" __config__ = [("activated", "bool", "Activated", True), ("username", "str", "Username", ""), @@ -76,12 +76,21 @@ class CaptchaTrader(Hook): #if type(captcha) == str and captchaType == "file": # raise CaptchaTraderException("Invalid Type") assert captchaType in ("file", "url-jpg", "url-jpeg", "url-png", "url-bmp") - #todo more timeout - json = getURL(CaptchaTrader.SUBMIT_URL, post={"api_key": PYLOAD_KEY, + + req = getRequest() + + #raise timeout threshold + req.c.setopt(LOW_SPEED_TIME, 80) + + try: + json = req.load(CaptchaTrader.SUBMIT_URL, post={"api_key": PYLOAD_KEY, "username": self.getConfig("username"), "password": self.getConfig("passkey"), "value": (FORM_FILE, captcha), "type": captchaType}, multipart=True) + finally: + req.close() + response = loads(json) if response[0] < 0: raise CaptchaTraderException(response[1]) |