本文整理匯總了Python中email.quopriMIME.unquote方法的典型用法代碼示例。如果您正苦於以下問題:Python quopriMIME.unquote方法的具體用法?Python quopriMIME.unquote怎麽用?Python quopriMIME.unquote使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類email.quopriMIME
的用法示例。
在下文中一共展示了quopriMIME.unquote方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_set_param
# 需要導入模塊: from email import quopriMIME [as 別名]
# 或者: from email.quopriMIME import unquote [as 別名]
def test_set_param(self):
eq = self.assertEqual
msg = Message()
msg.set_param('charset', 'iso-2022-jp')
eq(msg.get_param('charset'), 'iso-2022-jp')
msg.set_param('importance', 'high value')
eq(msg.get_param('importance'), 'high value')
eq(msg.get_param('importance', unquote=False), '"high value"')
eq(msg.get_params(), [('text/plain', ''),
('charset', 'iso-2022-jp'),
('importance', 'high value')])
eq(msg.get_params(unquote=False), [('text/plain', ''),
('charset', '"iso-2022-jp"'),
('importance', '"high value"')])
msg.set_param('charset', 'iso-9999-xx', header='X-Jimmy')
eq(msg.get_param('charset', header='X-Jimmy'), 'iso-9999-xx')
示例2: test_get_param_with_semis_in_quotes
# 需要導入模塊: from email import quopriMIME [as 別名]
# 或者: from email.quopriMIME import unquote [as 別名]
def test_get_param_with_semis_in_quotes(self):
msg = email.message_from_string(
'Content-Type: image/pjpeg; name="Jim&&Jill"\n')
self.assertEqual(msg.get_param('name'), 'Jim&&Jill')
self.assertEqual(msg.get_param('name', unquote=False),
'"Jim&&Jill"')
示例3: test_quote_unquote_idempotent
# 需要導入模塊: from email import quopriMIME [as 別名]
# 或者: from email.quopriMIME import unquote [as 別名]
def test_quote_unquote_idempotent(self):
for x in range(256):
c = chr(x)
self.assertEqual(quopriMIME.unquote(quopriMIME.quote(c)), c)
示例4: test_get_param
# 需要導入模塊: from email import quopriMIME [as 別名]
# 或者: from email.quopriMIME import unquote [as 別名]
def test_get_param(self):
eq = self.assertEqual
msg = self._msgobj('msg_29.txt')
eq(msg.get_param('title'),
('us-ascii', 'en', 'This is even more ***fun*** isn\'t it!'))
eq(msg.get_param('title', unquote=False),
('us-ascii', 'en', '"This is even more ***fun*** isn\'t it!"'))