(content_disposition)
>>> extract_build_info_from_filename(
    ...     'attachment; filename=CommCare_CommCare_2.13_32703_artifacts.zip'
    ... )
    ('2.13', 32703)
    >>> try:
    ...     extract_build_info_from_filename('foo')
    ... except ValueError as e:
    ...     print e
    Could not find filename like 'CommCare_CommCare_([\\\\d\\\\.]+)_(\\\\d+)_artifacts.zip' in 'foo'
def extract_build_info_from_filename(content_disposition):
    """

    >>> extract_build_info_from_filename(
    ...     'attachment; filename=CommCare_CommCare_2.13_32703_artifacts.zip'
    ... )
    ('2.13', 32703)
    >>> try:
    ...     extract_build_info_from_filename('foo')
    ... except ValueError as e:
    ...     print e
    Could not find filename like 'CommCare_CommCare_([\\\\d\\\\.]+)_(\\\\d+)_artifacts.zip' in 'foo'

    """
    pattern = r'CommCare_CommCare_([\d\.]+)_(\d+)_artifacts.zip'
    match = re.search(pattern, content_disposition)
    if match:
        version, number = match.groups()
        return version, int(number)
    else:
        raise ValueError('Could not find filename like {!r} in {!r}'.format(
            pattern, content_disposition))
def extract_build_info_from_filename ( content_disposition ) : pattern = r'CommCare_CommCare_([\d\.]+)_(\d+)_artifacts.zip' match = re . search ( pattern , content_disposition ) if match : version , number = match . groups ( ) return version , int ( number ) else : raise ValueError ( 'Could not find filename like {!r} in {!r}' . format ( pattern , content_disposition ) )