server.py 文件源码

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

项目:farfetchd 作者: isislovecruft 项目源码 文件源码
def main():
    log.startLogging(sys.stdout)

    captchaKey = crypto.getKey(FARFETCHD_CAPTCHA_HMAC_KEYFILE)
    hmacKey = crypto.getHMAC(captchaKey, "Captcha-Key")

    # Load or create our encryption keys:
    secretKey, publicKey = crypto.getRSAKey(FARFETCHD_CAPTCHA_RSA_KEYFILE)

    index = CaptchaResource()
    fetch = CaptchaFetchResource(hmacKey, publicKey, secretKey)
    check = CaptchaCheckResource(hmacKey, publicKey, secretKey)

    root = index
    root.putChild("fetch", fetch)
    root.putChild("check", check)

    site = HttpJsonApiServer(root)
    port = FARFETCHD_HTTP_PORT or 80
    host = FARFETCHD_HTTP_HOST or '127.0.0.1'

    reactor.listenTCP(port, site, interface=host)
    reactor.run()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号