复制代码 代码如下:
from urllib.request import urlopen
from urllib.parse import urlencode
import tornado.httpserver
import tornado.ioloop
import tornado.web
#获取key: https://www.google.com/recaptcha/whyrecaptcha
publickey = '填入你的 public key'
privatekey = '填入你的 private key'
class Application(tornado.web.Application):
def __init__(self):
handlers = [
(r'/', IndexHandler)
]
settings = dict(
template_path="templates",
)
tornado.web.Application.__init__(self, handlers, **settings)
class IndexHandler(tornado.web.RequestHandler):
def get(self):
self.render('index.html', publickey=publickey)
def post(self):
url = 'http://www.google.com/recaptcha/api/verify'
#验证码
challenge = self.get_argument('recaptcha_challenge_field')
#用户输入
response = self.get_argument('recaptcha_response_field')
data = {
'privatekey': privatekey,
'remoteip': self.request.remote_ip,
'challenge': challenge,
'response': response
}
res = urlopen(url, data=urlencode(data).encode())
#获取验证结果,这里直接将返回结果输出到页面
self.write(res.read().decode())
if __name__ == '__main__':
server = tornado.httpserver.HTTPServer(Application())
server.listen(10001)
tornado.ioloop.IOLoop.instance().start()
templates/index.html
复制代码 代码如下:
jb51.net<!DOCTYPE html>
jb51.net<html>
jb51.net<head>
jb51.netjb51.net<title>reCaptcha验证码</title>
jb51.net</head>
jb51.net<body>
jb51.netjb51.net<form action="" method="post">
jb51.netjb51.net<script type="text/javascript" src="/UploadFiles/2021-04-08/challenge?k={{ publickey }}">jb51.netjb51.net<noscript>
jb51.netjb51.netjb51.net<iframe src="http://www.google.com/recaptcha/api/noscript?k={{ publickey }}">jb51.netjb51.netjb51.net<textarea name="recaptcha_challenge_field" rows="3" cols="40"></textarea>
jb51.netjb51.netjb51.net<input type="hidden" name="recaptcha_response_field" value="manual_challenge">
jb51.netjb51.net</noscript>
jb51.netjb51.net</form>
jb51.net</body>
jb51.net</html>
更新日志
- 小骆驼-《草原狼2(蓝光CD)》[原抓WAV+CUE]
- 群星《欢迎来到我身边 电影原声专辑》[320K/MP3][105.02MB]
- 群星《欢迎来到我身边 电影原声专辑》[FLAC/分轨][480.9MB]
- 雷婷《梦里蓝天HQⅡ》 2023头版限量编号低速原抓[WAV+CUE][463M]
- 群星《2024好听新歌42》AI调整音效【WAV分轨】
- 王思雨-《思念陪着鸿雁飞》WAV
- 王思雨《喜马拉雅HQ》头版限量编号[WAV+CUE]
- 李健《无时无刻》[WAV+CUE][590M]
- 陈奕迅《酝酿》[WAV分轨][502M]
- 卓依婷《化蝶》2CD[WAV+CUE][1.1G]
- 群星《吉他王(黑胶CD)》[WAV+CUE]
- 齐秦《穿乐(穿越)》[WAV+CUE]
- 发烧珍品《数位CD音响测试-动向效果(九)》【WAV+CUE】
- 邝美云《邝美云精装歌集》[DSF][1.6G]
- 吕方《爱一回伤一回》[WAV+CUE][454M]