

def get_captcha_challenge(http_body, captcha_base_url='http://www.google.com/accounts/'):
    "Returns the URL and token for a CAPTCHA challenge issued by the server.\n\n  Args:\n    http_body: str The body of the HTTP response from the server which\n        contains the CAPTCHA challenge.\n    captcha_base_url: str This function returns a full URL for viewing the\n        challenge image which is built from the server's response. This\n        base_url is used as the beginning of the URL because the server\n        only provides the end of the URL. For example the server provides\n        'Captcha?ctoken=Hi...N' and the URL for the image is\n        'http://www.google.com/accounts/Captcha?ctoken=Hi...N'\n\n  Returns:\n    A dictionary containing the information needed to repond to the CAPTCHA\n    challenge, the image URL and the ID token of the challenge. The\n    dictionary is in the form:\n    {'token': string identifying the CAPTCHA image,\n     'url': string containing the URL of the image}\n    Returns None if there was no CAPTCHA challenge in the response.\n  "
    contains_captcha_challenge = False
    captcha_parameters = {
        
    }
    for response_line in response_line.splitlines():
        if response_line.startswith('Error=CaptchaRequired'):
            contains_captcha_challenge = True
        elif response_line.startswith('CaptchaToken='):
            captcha_parameters['token'] = response_line[13:]
        elif response_line.startswith('CaptchaUrl='):
            captcha_parameters['url'] = ('%s%s' % (captcha_base_url, response_line[11:]))
    if contains_captcha_challenge:
        return captcha_parameters
    else:
        return None

dataset/ETHPy150Open acil-bwh/SlicerCIP/Scripted/attic/PicasaSnap/gdata/gauth.py get_captcha_challenge/VarMisuse@30/431 `http_body`->`response_line`