本文整理匯總了Python中flanker.mime.message.headers.MimeHeaders.get方法的典型用法代碼示例。如果您正苦於以下問題:Python MimeHeaders.get方法的具體用法?Python MimeHeaders.get怎麽用?Python MimeHeaders.get使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類flanker.mime.message.headers.MimeHeaders
的用法示例。
在下文中一共展示了MimeHeaders.get方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: headers_alternation_test
# 需要導入模塊: from flanker.mime.message.headers import MimeHeaders [as 別名]
# 或者: from flanker.mime.message.headers.MimeHeaders import get [as 別名]
def headers_alternation_test():
headers = [('mime-version', '1'), ('rEceived', '2'), ('mime-version', '3'), ('ReceiveD', '4')]
h = MimeHeaders(headers)
assert_false(h.have_changed())
h.prepend('Received', 'Yo')
ok_(h.have_changed())
h = MimeHeaders(headers)
del h['Mime-Version']
ok_(h.have_changed())
h = MimeHeaders(headers)
h['Mime-Version'] = 'a'
ok_(h.have_changed())
h = MimeHeaders(headers)
h.add('Mime-Version', 'a')
ok_(h.have_changed())
h = MimeHeaders(headers)
h.getall('Mime-Version')
h.get('o')
assert_false(h.have_changed())
示例2: headers_case_insensitivity_test
# 需要導入模塊: from flanker.mime.message.headers import MimeHeaders [as 別名]
# 或者: from flanker.mime.message.headers.MimeHeaders import get [as 別名]
def headers_case_insensitivity_test():
h = MimeHeaders()
h['Content-Type'] = 1
eq_(1, h['Content-Type'])
eq_(1, h['conTenT-TyPE'])
ok_('cOnTenT-TyPE' in h)
ok_('Content-Type' in h)
eq_(1, h.get('Content-Type'))
eq_(None, h.get('Content-Type2'))
eq_([('Content-Type', 1)], h.items())
示例3: headers_transform_encodedword_test
# 需要導入模塊: from flanker.mime.message.headers import MimeHeaders [as 別名]
# 或者: from flanker.mime.message.headers.MimeHeaders import get [as 別名]
def headers_transform_encodedword_test():
# Create a header with non-ascii characters that will be stored in encoded-word format.
headers = [('Subject', encoding.to_mime('Subject', u'Hello ✓'))]
h = MimeHeaders(headers)
# transform should decode it for us when we pass decode=True
h.transform(lambda key,val: (key, val.replace(u'✓', u'☃')), decode=True)
eq_(u'Hello ☃', h.get('Subject'))