server.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:farfetchd 作者: isislovecruft 项目源码 文件源码
def render_POST(self, request):
        """Process a client's CAPTCHA solution.

        If the client's CAPTCHA solution is valid (according to
        :meth:`checkSolution`), process and serve their original
        request. Otherwise, redirect them back to a new CAPTCHA page.

        :type request: :api:`twisted.web.http.Request`
        :param request: A ``Request`` object, including POST arguments which
            should include two key/value pairs: one key being
            ``'captcha_challenge_field'``, and the other,
            ``'captcha_response_field'``. These POST arguments should be
            obtained from :meth:`render_GET`.
        :rtype: str
        :returns: A rendered HTML page containing a ReCaptcha challenge image
            for the client to solve.
        """
        data = {
            "data": {
                "id": 3,
                "type": self.responseType,
                "version": FARFETCHD_API_VERSION,
                "result": False,
            }
        }

        try:
            if self.checkSolution(request) is True:
                data["data"]["result"] = True
                return self.formatResponse(data, request)
            else:
                return self.failureResponse(request)
        except Exception as err:
            log.err(err)


#class FarfetchdRequestHandler(http.Request):
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号