ietfparse/headers.py
def parse_content_type(content_type, normalize_parameter_values=True):
    """Parse a content type like header.

    :param str content_type: the string to parse as a content type
    :param bool normalize_parameter_values:
        setting this to ``False`` will enable strict RFC2045 compliance
        in which content parameter values are case preserving.
    :return: a :class:`~ietfparse.datastructures.ContentType` instance

    """
    parts = _remove_comments(content_type).split(';')
    content_type, content_subtype = parts.pop(0).split('/')
    if '+' in content_subtype:
        content_subtype, content_suffix = content_subtype.split('+')
    else:
        content_suffix = None
    parameters = _parse_parameter_list(
        parts, normalize_parameter_values=normalize_parameter_values)

    return datastructures.ContentType(content_type, content_subtype,
                                      dict(parameters),
                                      content_suffix)
def parse_content_type(content_type, normalize_parameter_values=True):
    parts = _remove_comments(content_type).split(';')
    content_type, content_subtype = parts.pop(0).split('/')
    if '+' in content_subtype:
        content_subtype, content_suffix = content_subtype.split('+')
    else:
        content_suffix = None
    parameters = _parse_parameter_list(
        parts, normalize_parameter_values=normalize_parameter_values)

    return datastructures.ContentType(content_type, content_subtype,
                                      dict(parameters),
                                      content_suffix)
def parse_content_type ( content_type , normalize_parameter_values = True ) : parts = _remove_comments ( content_type ) . split ( ';' ) content_type , content_subtype = parts . pop ( 0 ) . split ( '/' ) if '+' in content_subtype : content_subtype , content_suffix = content_subtype . split ( '+' ) else : content_suffix = None parameters = _parse_parameter_list ( parts , normalize_parameter_values = normalize_parameter_values ) return datastructures . ContentType ( content_type , content_subtype , dict ( parameters ) , content_suffix )
Parse a content type like header.

    :param str content_type: the string to parse as a content type
    :param bool normalize_parameter_values:
        setting this to ``False`` will enable strict RFC2045 compliance
        in which content parameter values are case preserving.
    :return: a :class:`~ietfparse.datastructures.ContentType` instance
Parse a content type like header .