當前位置: 首頁>>代碼示例>>Python>>正文


Python errors.HeaderMissingRequiredValue方法代碼示例

本文整理匯總了Python中future.backports.email.errors.HeaderMissingRequiredValue方法的典型用法代碼示例。如果您正苦於以下問題:Python errors.HeaderMissingRequiredValue方法的具體用法?Python errors.HeaderMissingRequiredValue怎麽用?Python errors.HeaderMissingRequiredValue使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在future.backports.email.errors的用法示例。


在下文中一共展示了errors.HeaderMissingRequiredValue方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: parse

# 需要導入模塊: from future.backports.email import errors [as 別名]
# 或者: from future.backports.email.errors import HeaderMissingRequiredValue [as 別名]
def parse(cls, value, kwds):
        if not value:
            kwds['defects'].append(errors.HeaderMissingRequiredValue())
            kwds['datetime'] = None
            kwds['decoded'] = ''
            kwds['parse_tree'] = parser.TokenList()
            return
        if isinstance(value, str):
            value = utils.parsedate_to_datetime(value)
        kwds['datetime'] = value
        kwds['decoded'] = utils.format_datetime(kwds['datetime'])
        kwds['parse_tree'] = cls.value_parser(kwds['decoded']) 
開發者ID:Soft8Soft,項目名稱:verge3d-blender-addon,代碼行數:14,代碼來源:headerregistry.py

示例2: parse_content_disposition_header

# 需要導入模塊: from future.backports.email import errors [as 別名]
# 或者: from future.backports.email.errors import HeaderMissingRequiredValue [as 別名]
def parse_content_disposition_header(value):
    """ disposition-type *( ";" parameter )

    """
    disp_header = ContentDisposition()
    if not value:
        disp_header.defects.append(errors.HeaderMissingRequiredValue(
            "Missing content disposition"))
        return disp_header
    try:
        token, value = get_token(value)
    except errors.HeaderParseError:
        ctype.defects.append(errors.InvalidHeaderDefect(
            "Expected content disposition but found {!r}".format(value)))
        _find_mime_parameters(disp_header, value)
        return disp_header
    disp_header.append(token)
    disp_header.content_disposition = token.value.strip().lower()
    if not value:
        return disp_header
    if value[0] != ';':
        disp_header.defects.append(errors.InvalidHeaderDefect(
            "Only parameters are valid after content disposition, but "
            "found {!r}".format(value)))
        _find_mime_parameters(disp_header, value)
        return disp_header
    disp_header.append(ValueTerminal(';', 'parameter-separator'))
    disp_header.append(parse_mime_parameters(value[1:]))
    return disp_header 
開發者ID:Soft8Soft,項目名稱:verge3d-blender-addon,代碼行數:31,代碼來源:_header_value_parser.py

示例3: parse_content_transfer_encoding_header

# 需要導入模塊: from future.backports.email import errors [as 別名]
# 或者: from future.backports.email.errors import HeaderMissingRequiredValue [as 別名]
def parse_content_transfer_encoding_header(value):
    """ mechanism

    """
    # We should probably validate the values, since the list is fixed.
    cte_header = ContentTransferEncoding()
    if not value:
        cte_header.defects.append(errors.HeaderMissingRequiredValue(
            "Missing content transfer encoding"))
        return cte_header
    try:
        token, value = get_token(value)
    except errors.HeaderParseError:
        ctype.defects.append(errors.InvalidHeaderDefect(
            "Expected content trnasfer encoding but found {!r}".format(value)))
    else:
        cte_header.append(token)
        cte_header.cte = token.value.strip().lower()
    if not value:
        return cte_header
    while value:
        cte_header.defects.append(errors.InvalidHeaderDefect(
            "Extra text after content transfer encoding"))
        if value[0] in PHRASE_ENDS:
            cte_header.append(ValueTerminal(value[0], 'misplaced-special'))
            value = value[1:]
        else:
            token, value = get_phrase(value)
            cte_header.append(token)
    return cte_header 
開發者ID:Soft8Soft,項目名稱:verge3d-blender-addon,代碼行數:32,代碼來源:_header_value_parser.py


注:本文中的future.backports.email.errors.HeaderMissingRequiredValue方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。