()
return key
Returns a string, which should be placed as a hidden field
    on a web form. This string identifies a particular challenge,
    and is needed later for:
        - retrieving the image file for viewing the challenge, via
          call to getImageData()
        - testing a response to the challenge, via call to testSolution()

    The format of the string is::
        
        base64(id+":"+expirytime+":"+sha1(id, answer, expirytime, secret))
    
    Where:
        - id is a pseudo-random id identifying this challenge instance, and
          used to locate the temporary file under which the image is stored
        - expirytime is unixtime in hex
        - answer is the plaintext string of the word on the challenge picture
        - secret is the secret signing key 'captchaSecretKey
Returns a string, which should be placed as a hidden field
    on a web form. This string identifies a particular challenge,
    and is needed later for:
        - retrieving the image file for viewing the challenge, via
          call to getImageData()
        - testing a response to the challenge, via call to testSolution()
Returns a string which should be placed as a hidden field on a web form . This string identifies a particular challenge and is needed later for : - retrieving the image file for viewing the challenge via call to getImageData () - testing a response to the challenge via call to testSolution ()
def getChallenge():
    """
    Returns a string, which should be placed as a hidden field
    on a web form. This string identifies a particular challenge,
    and is needed later for:
        - retrieving the image file for viewing the challenge, via
          call to getImageData()
        - testing a response to the challenge, via call to testSolution()

    The format of the string is::
        
        base64(id+":"+expirytime+":"+sha1(id, answer, expirytime, secret))
    
    Where:
        - id is a pseudo-random id identifying this challenge instance, and
          used to locate the temporary file under which the image is stored
        - expirytime is unixtime in hex
        - answer is the plaintext string of the word on the challenge picture
        - secret is the secret signing key 'captchaSecretKey
    """
    # get a CAPTCHA object
    g = PseudoGimpy()

    # retrieve text solution
    answer = g.solutions[0]
    
    # generate a unique id under which to save it
    id = _generateId(answer)

    # save the image to disk, so it can be delivered from the
    # browser's next request
    i = g.render()
    path = _getImagePath(id)
    f = file(path, "wb")
    i.save(f, "jpeg")
    f.close()

    # compute 'key'
    key = _encodeKey(id, answer)
    return key
def getChallenge ( ) : # get a CAPTCHA object g = PseudoGimpy ( ) # retrieve text solution answer = g . solutions [ 0 ] # generate a unique id under which to save it id = _generateId ( answer ) # save the image to disk, so it can be delivered from the # browser's next request i = g . render ( ) path = _getImagePath ( id ) f = file ( path , "wb" ) i . save ( f , "jpeg" ) f . close ( ) # compute 'key' key = _encodeKey ( id , answer ) return key