commit 032ac80ad1f14e3a47a0c28a0e5fff1a787e8c8e Author: Isis Lovecruft isis@torproject.org Date: Wed Mar 25 01:24:47 2015 +0000
Remove the need for the recaptcha-client dependency. --- lib/bridgedb/txrecaptcha.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-)
diff --git a/lib/bridgedb/txrecaptcha.py b/lib/bridgedb/txrecaptcha.py index 96b288c..a8a0532 100644 --- a/lib/bridgedb/txrecaptcha.py +++ b/lib/bridgedb/txrecaptcha.py @@ -25,9 +25,6 @@ which are copyright the authors of the recaptcha-client_ package. import logging import urllib
-from recaptcha.client.captcha import API_SSL_SERVER -from recaptcha.client.captcha import RecaptchaResponse -from recaptcha.client.captcha import displayhtml
from twisted import version as _twistedversion from twisted.internet import defer @@ -44,7 +41,8 @@ from zope.interface import implements from bridgedb.crypto import SSLVerifyingContextFactory
-API_SERVER = API_SSL_SERVER +#: This was taken from recaptcha.client.captcha.API_SSL_SERVER. +API_SSL_SERVER = API_SERVER = "https://www.google.com/recaptcha/api" API_SSL_VERIFY_URL = "%s/verify" % API_SSL_SERVER
# `t.w.client.HTTPConnectionPool` isn't available in Twisted-12.0.0 (see @@ -107,6 +105,15 @@ class RecaptchaResponseError(ValueError): """There was an error with the reCaptcha API server's response."""
+class RecaptchaResponse(object): + """Taken from recaptcha.client.captcha.`RecaptchaResponse`_. + .. RecaptchaResponse: https://code.google.com/p/recaptcha/source/browse/trunk/recaptcha-plugins/py... + """ + def __init__(self, is_valid, error_code=None): + self.is_valid = is_valid + self.error_code = error_code + + class RecaptchaResponseProtocol(protocol.Protocol): """HTML parser which creates a :class:`RecaptchaResponse` from the body of the reCaptcha API server's response.