本文整理匯總了Python中module.plugins.ReCaptcha.ReCaptcha.result方法的典型用法代碼示例。如果您正苦於以下問題:Python ReCaptcha.result方法的具體用法?Python ReCaptcha.result怎麽用?Python ReCaptcha.result使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類module.plugins.ReCaptcha.ReCaptcha
的用法示例。
在下文中一共展示了ReCaptcha.result方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: downloadFree
# 需要導入模塊: from module.plugins.ReCaptcha import ReCaptcha [as 別名]
# 或者: from module.plugins.ReCaptcha.ReCaptcha import result [as 別名]
def downloadFree(self):
self.logDebug("Free download")
# Get initial page
self.html = self.load(self.pyfile.url)
url = self.pyfile.url + "?start=1"
self.html = self.load(url)
self.handleErrors()
finalUrl = re.search(self.FILE_LINK_PATTERN, self.html)
if not finalUrl:
self.doWait(url)
chall = re.search(self.CAPTCHA_TYPE1_PATTERN, self.html)
chall2 = re.search(self.CAPTCHA_TYPE2_PATTERN, self.html)
if chall or chall2:
for i in range(5):
re_captcha = ReCaptcha(self)
if chall:
self.logDebug("Captcha type1")
challenge, result = re_captcha.challenge(chall.group(1))
else:
self.logDebug("Captcha type2")
server = chall2.group(1)
challenge = chall2.group(2)
result = re_captcha.result(server, challenge)
postData = {"recaptcha_challenge_field": challenge,
"recaptcha_response_field": result}
self.html = self.load(url, post=postData)
self.handleErrors()
chall = re.search(self.CAPTCHA_TYPE1_PATTERN, self.html)
chall2 = re.search(self.CAPTCHA_TYPE2_PATTERN, self.html)
if chall or chall2:
self.invalidCaptcha()
else:
self.correctCaptcha()
break
finalUrl = re.search(self.FILE_LINK_PATTERN, self.html)
if not finalUrl:
self.fail("Couldn't find free download link")
self.logDebug("got download url %s" % finalUrl.group(1))
self.download(finalUrl.group(1))