本文整理匯總了Python中imaplib.Time2Internaldate方法的典型用法代碼示例。如果您正苦於以下問題:Python imaplib.Time2Internaldate方法的具體用法?Python imaplib.Time2Internaldate怎麽用?Python imaplib.Time2Internaldate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類imaplib
的用法示例。
在下文中一共展示了imaplib.Time2Internaldate方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _multiappend
# 需要導入模塊: import imaplib [as 別名]
# 或者: from imaplib import Time2Internaldate [as 別名]
def _multiappend(con, box, msgs):
with _cmd(con, 'APPEND') as (tag, start, complete):
send = start
for date_time, flags, msg in msgs:
flags = clean_recent(flags)
if date_time is None:
date_time = Time2Internaldate(time.time())
args = (' (%s) %s %s' % (flags, date_time, '{%s}' % len(msg)))
if send == start:
args = ' %s %s' % (box, args)
send(args.encode() + CRLF)
send = con.send
while con._get_response():
bad = con.tagged_commands[tag]
if bad:
raise Error(bad)
con.send(msg)
con.send(CRLF)
res = check(complete())
log.debug('%s', res[0].decode())
uids = con.untagged_responses.pop('APPENDUID')
uids = uids[0].decode().split(' ', 1)[-1]
return uids
示例2: test_that_Time2Internaldate_returns_a_result
# 需要導入模塊: import imaplib [as 別名]
# 或者: from imaplib import Time2Internaldate [as 別名]
def test_that_Time2Internaldate_returns_a_result(self):
# We can check only that it successfully produces a result,
# not the correctness of the result itself, since the result
# depends on the timezone the machine is in.
timevalues = [2000000000, 2000000000.0, time.localtime(2000000000),
'"18-May-2033 05:33:20 +0200"']
for t in timevalues:
imaplib.Time2Internaldate(t)
示例3: test_Time2Internaldate
# 需要導入模塊: import imaplib [as 別名]
# 或者: from imaplib import Time2Internaldate [as 別名]
def test_Time2Internaldate(self):
expected = '"18-May-2033 05:33:20 +0200"'
for t in self.timevalues():
internal = imaplib.Time2Internaldate(t)
self.assertEqual(internal, expected)
示例4: test_that_Time2Internaldate_returns_a_result
# 需要導入模塊: import imaplib [as 別名]
# 或者: from imaplib import Time2Internaldate [as 別名]
def test_that_Time2Internaldate_returns_a_result(self):
# Without tzset, we can check only that it successfully
# produces a result, not the correctness of the result itself,
# since the result depends on the timezone the machine is in.
for t in self.timevalues():
imaplib.Time2Internaldate(t)
示例5: push_mail
# 需要導入模塊: import imaplib [as 別名]
# 或者: from imaplib import Time2Internaldate [as 別名]
def push_mail(self, folder, msg):
now = imaplib.Time2Internaldate(time.time())
msg = bytes(msg) if six.PY3 else str(msg)
return self.m.append(
self._encode_mbox_name(folder), r'(\Seen)', now, msg)