Beispiel #1
0
def getImage(request, index):
    visualCaptcha = Captcha(Session(request.session))

    headers = {}
    result = visualCaptcha.streamImage(headers, index)

    if result is False:
        return HttpResponse(result, headers, 404)

    return HttpResponse(result, headers)
Beispiel #2
0
def getImage(request, index):
    visualCaptcha = Captcha(Session(request.session))

    headers = {}
    result = visualCaptcha.streamImage(
        headers, index, request.GET.get('retina'))

    if result is False:
        return HttpResponse(result, headers, 404)

    return HttpResponse(result, headers)
Beispiel #3
0
    def get(self, cmd, arg=None):
        if cmd == "start":

            visualCaptcha = Captcha(Session(self.session.session))

            visualCaptcha.generate(int(arg))
            self.write(visualCaptcha.getFrontendData())

        elif cmd == "audio":
            visualCaptcha = Captcha(Session(self.session.session))

            headers = {}
            result = visualCaptcha.streamAudio(headers, 'mp3')
            self.write(result)

        elif cmd == "image":
            visualCaptcha = Captcha(Session(self.session.session))

            headers = {}
            result = visualCaptcha.streamImage(headers, int(arg))
            self.write(result)