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


Python quopri.decode方法代碼示例

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


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

示例1: decode

# 需要導入模塊: import quopri [as 別名]
# 或者: from quopri import decode [as 別名]
def decode(input, output, encoding):
    """Decode common content-transfer-encodings (base64, quopri, uuencode)."""
    if encoding == 'base64':
        import base64
        return base64.decode(input, output)
    if encoding == 'quoted-printable':
        import quopri
        return quopri.decode(input, output)
    if encoding in ('uuencode', 'x-uuencode', 'uue', 'x-uue'):
        import uu
        return uu.decode(input, output)
    if encoding in ('7bit', '8bit'):
        return output.write(input.read())
    if encoding in decodetab:
        pipethrough(input, decodetab[encoding], output)
    else:
        raise ValueError, \
              'unknown Content-Transfer-Encoding: %s' % encoding 
開發者ID:glmcdona,項目名稱:meddle,代碼行數:20,代碼來源:mimetools.py

示例2: _decode

# 需要導入模塊: import quopri [as 別名]
# 或者: from quopri import decode [as 別名]
def _decode(self, headers, fileobj):
        encoding = headers[-1].get_all("content-transfer-encoding", ["7bit"])[0]
        encoding = encoding.lower()

        if encoding == "base64":
            try:
                data = base64.b64decode(fileobj.read())
            except TypeError as error:
                self.log.error("Base64 decoding failed ({0})".format(error))
                idiokit.stop(False)
            return StringIO(data)

        if encoding == "quoted-printable":
            output = StringIO()
            quopri.decode(fileobj, output)
            output.seek(0)
            return output

        return fileobj 
開發者ID:abusesa,項目名稱:abusehelper,代碼行數:21,代碼來源:shadowservermail.py

示例3: quopri_decode

# 需要導入模塊: import quopri [as 別名]
# 或者: from quopri import decode [as 別名]
def quopri_decode(input, errors='strict'):
    """Decode the input, returning a tuple (output object, length consumed).

    errors defines the error handling to apply. It defaults to
    'strict' handling which is the only currently supported
    error handling for this codec.

    """
    assert errors == 'strict'
    f = StringIO(str(input))
    g = StringIO()
    quopri.decode(f, g)
    output = g.getvalue()
    return (output, len(input)) 
開發者ID:glmcdona,項目名稱:meddle,代碼行數:16,代碼來源:quopri_codec.py

示例4: decode

# 需要導入模塊: import quopri [as 別名]
# 或者: from quopri import decode [as 別名]
def decode(self, input,errors='strict'):
        return quopri_decode(input,errors) 
開發者ID:glmcdona,項目名稱:meddle,代碼行數:4,代碼來源:quopri_codec.py

示例5: getregentry

# 需要導入模塊: import quopri [as 別名]
# 或者: from quopri import decode [as 別名]
def getregentry():
    return codecs.CodecInfo(
        name='quopri',
        encode=quopri_encode,
        decode=quopri_decode,
        incrementalencoder=IncrementalEncoder,
        incrementaldecoder=IncrementalDecoder,
        streamwriter=StreamWriter,
        streamreader=StreamReader,
    ) 
開發者ID:glmcdona,項目名稱:meddle,代碼行數:12,代碼來源:quopri_codec.py

示例6: getregentry

# 需要導入模塊: import quopri [as 別名]
# 或者: from quopri import decode [as 別名]
def getregentry():
    return codecs.CodecInfo(
        name='quopri',
        encode=quopri_encode,
        decode=quopri_decode,
        incrementalencoder=IncrementalEncoder,
        incrementaldecoder=IncrementalDecoder,
        streamwriter=StreamWriter,
        streamreader=StreamReader,
        _is_text_encoding=False,
    ) 
開發者ID:IronLanguages,項目名稱:ironpython2,代碼行數:13,代碼來源:quopri_codec.py

示例7: quopri_decode

# 需要導入模塊: import quopri [as 別名]
# 或者: from quopri import decode [as 別名]
def quopri_decode(input, errors='strict'):
    assert errors == 'strict'
    f = BytesIO(input)
    g = BytesIO()
    quopri.decode(f, g)
    return (g.getvalue(), len(input)) 
開發者ID:awemulya,項目名稱:kobo-predict,代碼行數:8,代碼來源:quopri_codec.py

示例8: decode

# 需要導入模塊: import quopri [as 別名]
# 或者: from quopri import decode [as 別名]
def decode(self, input, errors='strict'):
        return quopri_decode(input, errors) 
開發者ID:awemulya,項目名稱:kobo-predict,代碼行數:4,代碼來源:quopri_codec.py


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