Python quopri 模块,encodestring() 实例源码

我们从Python开源项目中,提取了以下50个代码示例,用于说明如何使用quopri.encodestring()

项目:chrome-prerender    作者:bosondata    | 项目源码 | 文件源码
def add(self, location: str, content_type: str, payload: str, encoding: str = 'quoted-printable') -> None:
        resource = EmailMessage()
        if content_type == 'text/html':
            resource.add_header('Content-Type', 'text/html', charset='utf-8')
        else:
            resource['Content-Type'] = content_type
        if encoding == 'quoted-printable':
            resource['Content-Transfer-Encoding'] = encoding
            resource.set_payload(quopri.encodestring(payload.encode()))
        elif encoding == 'base64':
            resource['Content-Transfer-Encoding'] = encoding
            resource.set_payload(base64.b64encode(payload))
        elif encoding == 'base64-encoded':  # Already base64 encoded
            resource['Content-Transfer-Encoding'] = 'base64'
            resource.set_payload(payload)
        else:
            raise ValueError('invalid encoding')
        resource['Content-Location'] = location
        self._msg.attach(resource)
项目:kinect-2-libras    作者:inessadl    | 项目源码 | 文件源码
def _qencode(s):
    enc = _encodestring(s, quotetabs=True)
    # Must encode spaces, which quopri.encodestring() doesn't do
    return enc.replace(' ', '=20')
项目:Flask_Blog    作者:sugarguo    | 项目源码 | 文件源码
def _qencode(s):
    enc = _encodestring(s, quotetabs=True)
    # Must encode spaces, which quopri.encodestring() doesn't do
    return enc.replace(' ', '=20')
项目:hostapd-mana    作者:adde88    | 项目源码 | 文件源码
def _qencode(s):
    enc = _encodestring(s, quotetabs=True)
    # Must encode spaces, which quopri.encodestring() doesn't do
    return enc.replace(' ', '=20')
项目:isthislegit    作者:duo-labs    | 项目源码 | 文件源码
def encode_transfer_encoding(encoding, body):
    if encoding == 'quoted-printable':
        return quopri.encodestring(body, quotetabs=False)
    elif encoding == 'base64':
        return email.encoders._bencode(body)
    else:
        return body
项目:Intranet-Penetration    作者:yuxiaokui    | 项目源码 | 文件源码
def _qencode(s):
    enc = _encodestring(s, quotetabs=True)
    # Must encode spaces, which quopri.encodestring() doesn't do
    return enc.replace(' ', '=20')
项目:MKFQ    作者:maojingios    | 项目源码 | 文件源码
def _qencode(s):
    enc = _encodestring(s, quotetabs=True)
    # Must encode spaces, which quopri.encodestring() doesn't do
    return enc.replace(' ', '=20')
项目:hakkuframework    作者:4shadoww    | 项目源码 | 文件源码
def _qencode(s):
    enc = _encodestring(s, quotetabs=True)
    # Must encode spaces, which quopri.encodestring() doesn't do
    return enc.replace(' ', '=20')
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def test_encodestring(self):
        for p, e in self.STRINGS:
            self.assertEqual(quopri.encodestring(p), e)
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def test_idempotent_string(self):
        for p, e in self.STRINGS:
            self.assertEqual(quopri.decodestring(quopri.encodestring(e)), e)
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def test_embedded_ws(self):
        for p, e in self.ESTRINGS:
            self.assertEqual(quopri.encodestring(p, quotetabs=True), e)
            self.assertEqual(quopri.decodestring(e), p)
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def test_encode_header(self):
        for p, e in self.HSTRINGS:
            self.assertEqual(quopri.encodestring(p, header=True), e)
项目:zippy    作者:securesystemslab    | 项目源码 | 文件源码
def _qencode(s):
    enc = _encodestring(s, quotetabs=True)
    # Must encode spaces, which quopri.encodestring() doesn't do
    return enc.replace(' ', '=20')
项目:oil    作者:oilshell    | 项目源码 | 文件源码
def test_encodestring(self):
        for p, e in self.STRINGS:
            self.assertTrue(quopri.encodestring(p) == e)
项目:oil    作者:oilshell    | 项目源码 | 文件源码
def test_idempotent_string(self):
        for p, e in self.STRINGS:
            self.assertTrue(quopri.decodestring(quopri.encodestring(e)) == e)
项目:oil    作者:oilshell    | 项目源码 | 文件源码
def test_embedded_ws(self):
        for p, e in self.ESTRINGS:
            self.assertTrue(quopri.encodestring(p, quotetabs=True) == e)
            self.assertTrue(quopri.decodestring(e) == p)
项目:oil    作者:oilshell    | 项目源码 | 文件源码
def test_encode_header(self):
        for p, e in self.HSTRINGS:
            self.assertTrue(quopri.encodestring(p, header=True) == e)
项目:oil    作者:oilshell    | 项目源码 | 文件源码
def _qencode(s):
    enc = _encodestring(s, quotetabs=True)
    # Must encode spaces, which quopri.encodestring() doesn't do
    return enc.replace(' ', '=20')
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def test_encodestring(self):
        for p, e in self.STRINGS:
            self.assertTrue(quopri.encodestring(p) == e)
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def test_idempotent_string(self):
        for p, e in self.STRINGS:
            self.assertTrue(quopri.decodestring(quopri.encodestring(e)) == e)
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def test_embedded_ws(self):
        for p, e in self.ESTRINGS:
            self.assertTrue(quopri.encodestring(p, quotetabs=True) == e)
            self.assertTrue(quopri.decodestring(e) == p)
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def test_encode_header(self):
        for p, e in self.HSTRINGS:
            self.assertTrue(quopri.encodestring(p, header=True) == e)
项目:python2-tracer    作者:extremecoders-re    | 项目源码 | 文件源码
def _qencode(s):
    enc = _encodestring(s, quotetabs=True)
    # Must encode spaces, which quopri.encodestring() doesn't do
    return enc.replace(' ', '=20')
项目:packaging    作者:blockstack    | 项目源码 | 文件源码
def _qencode(s):
    enc = _encodestring(s, quotetabs=True)
    # Must encode spaces, which quopri.encodestring() doesn't do
    return enc.replace(' ', '=20')
项目:sslstrip-hsts-openwrt    作者:adde88    | 项目源码 | 文件源码
def _qencode(s):
    enc = _encodestring(s, quotetabs=True)
    # Must encode spaces, which quopri.encodestring() doesn't do
    return enc.replace(' ', '=20')
项目:islam-buddy    作者:hamir    | 项目源码 | 文件源码
def _qencode(s):
    enc = _encodestring(s, quotetabs=True)
    # Must encode spaces, which quopri.encodestring() doesn't do
    return enc.replace(' ', '=20')
项目:web_ctp    作者:molebot    | 项目源码 | 文件源码
def test_encodestring(self):
        for p, e in self.STRINGS:
            self.assertEqual(quopri.encodestring(p), e)
项目:web_ctp    作者:molebot    | 项目源码 | 文件源码
def test_idempotent_string(self):
        for p, e in self.STRINGS:
            self.assertEqual(quopri.decodestring(quopri.encodestring(e)), e)
项目:web_ctp    作者:molebot    | 项目源码 | 文件源码
def test_embedded_ws(self):
        for p, e in self.ESTRINGS:
            self.assertEqual(quopri.encodestring(p, quotetabs=True), e)
            self.assertEqual(quopri.decodestring(e), p)
项目:web_ctp    作者:molebot    | 项目源码 | 文件源码
def test_encode_header(self):
        for p, e in self.HSTRINGS:
            self.assertEqual(quopri.encodestring(p, header=True), e)
项目:FightstickDisplay    作者:calexil    | 项目源码 | 文件源码
def _qencode(s):
    enc = _encodestring(s, quotetabs=True)
    # Must encode spaces, which quopri.encodestring() doesn't do
    return enc.replace(' ', '=20')
项目:xxNet    作者:drzorm    | 项目源码 | 文件源码
def _qencode(s):
    enc = _encodestring(s, quotetabs=True)
    # Must encode spaces, which quopri.encodestring() doesn't do
    return enc.replace(' ', '=20')
项目:cryptogram    作者:xinmingzhang    | 项目源码 | 文件源码
def _qencode(s):
    enc = _encodestring(s, quotetabs=True)
    # Must encode spaces, which quopri.encodestring() doesn't do
    return enc.replace(' ', '=20')
项目:Repobot    作者:Desgard    | 项目源码 | 文件源码
def _qencode(s):
    enc = _encodestring(s, quotetabs=True)
    # Must encode spaces, which quopri.encodestring() doesn't do
    return enc.replace(' ', '=20')
项目:pefile.pypy    作者:cloudtracer    | 项目源码 | 文件源码
def test_encodestring(self):
        for p, e in self.STRINGS:
            self.assertTrue(quopri.encodestring(p) == e)
项目:pefile.pypy    作者:cloudtracer    | 项目源码 | 文件源码
def test_idempotent_string(self):
        for p, e in self.STRINGS:
            self.assertTrue(quopri.decodestring(quopri.encodestring(e)) == e)
项目:pefile.pypy    作者:cloudtracer    | 项目源码 | 文件源码
def test_embedded_ws(self):
        for p, e in self.ESTRINGS:
            self.assertTrue(quopri.encodestring(p, quotetabs=True) == e)
            self.assertTrue(quopri.decodestring(e) == p)
项目:pefile.pypy    作者:cloudtracer    | 项目源码 | 文件源码
def test_encode_header(self):
        for p, e in self.HSTRINGS:
            self.assertTrue(quopri.encodestring(p, header=True) == e)
项目:pefile.pypy    作者:cloudtracer    | 项目源码 | 文件源码
def _qencode(s):
    enc = _encodestring(s, quotetabs=True)
    # Must encode spaces, which quopri.encodestring() doesn't do
    return enc.replace(' ', '=20')
项目:ouroboros    作者:pybee    | 项目源码 | 文件源码
def test_encodestring(self):
        for p, e in self.STRINGS:
            self.assertEqual(quopri.encodestring(p), e)
项目:ouroboros    作者:pybee    | 项目源码 | 文件源码
def test_idempotent_string(self):
        for p, e in self.STRINGS:
            self.assertEqual(quopri.decodestring(quopri.encodestring(e)), e)
项目:ouroboros    作者:pybee    | 项目源码 | 文件源码
def test_embedded_ws(self):
        for p, e in self.ESTRINGS:
            self.assertEqual(quopri.encodestring(p, quotetabs=True), e)
            self.assertEqual(quopri.decodestring(e), p)
项目:ouroboros    作者:pybee    | 项目源码 | 文件源码
def test_encode_header(self):
        for p, e in self.HSTRINGS:
            self.assertEqual(quopri.encodestring(p, header=True), e)
项目:ouroboros    作者:pybee    | 项目源码 | 文件源码
def _qencode(s):
    enc = _encodestring(s, quotetabs=True)
    # Must encode spaces, which quopri.encodestring() doesn't do
    return enc.replace(b' ', b'=20')
项目:ndk-python    作者:gittor    | 项目源码 | 文件源码
def test_encodestring(self):
        for p, e in self.STRINGS:
            self.assertTrue(quopri.encodestring(p) == e)
项目:ndk-python    作者:gittor    | 项目源码 | 文件源码
def test_idempotent_string(self):
        for p, e in self.STRINGS:
            self.assertTrue(quopri.decodestring(quopri.encodestring(e)) == e)
项目:ndk-python    作者:gittor    | 项目源码 | 文件源码
def test_embedded_ws(self):
        for p, e in self.ESTRINGS:
            self.assertTrue(quopri.encodestring(p, quotetabs=True) == e)
            self.assertTrue(quopri.decodestring(e) == p)
项目:ndk-python    作者:gittor    | 项目源码 | 文件源码
def test_encode_header(self):
        for p, e in self.HSTRINGS:
            self.assertTrue(quopri.encodestring(p, header=True) == e)
项目:ndk-python    作者:gittor    | 项目源码 | 文件源码
def _qencode(s):
    enc = _encodestring(s, quotetabs=True)
    # Must encode spaces, which quopri.encodestring() doesn't do
    return enc.replace(' ', '=20')
项目:empyrion-python-api    作者:huhlig    | 项目源码 | 文件源码
def _qencode(s):
    enc = _encodestring(s, quotetabs=True)
    # Must encode spaces, which quopri.encodestring() doesn't do
    return enc.replace(' ', '=20')