本文整理汇总了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)