def _validate_recaptcha(self, challenge, response, remote_addr):
        """Performs the actual validation."""
        private_key = current_handler.get_config('tipfyext.wtforms',
            'recaptcha_private_key')
        result = urlfetch.fetch(url=RECAPTCHA_VERIFY_SERVER,
            method=urlfetch.POST,
            headers={'Content-Type': 'application/x-www-form-urlencoded'},
            payload=url_encode({
                'privatekey': private_key,
                'remoteip':   remote_addr,
                'challenge':  challenge,
                'response':   response
            }))

        if result.status_code != 200:
            return False

        rv = [l.strip() for l in result.content.splitlines()]

        if rv and rv[0] == 'true':
            return True

        if len(rv) > 1:
            error = rv[1]
            if error in self._error_codes:
                raise RuntimeError(self._error_codes[error])

        return False
dataset/ETHPy150Open moraes/tipfy/tipfyext/wtforms/validators.py/Recaptcha._validate_recaptcha/original