本文整理汇总了Python中rfc822.parsedate方法的典型用法代码示例。如果您正苦于以下问题:Python rfc822.parsedate方法的具体用法?Python rfc822.parsedate怎么用?Python rfc822.parsedate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rfc822
的用法示例。
在下文中一共展示了rfc822.parsedate方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: get_header
# 需要导入模块: import rfc822 [as 别名]
# 或者: from rfc822 import parsedate [as 别名]
def get_header(patch, line, input):
if line == '':
if patch.author == '':
print 'Funky auth line in', patch.commit
patch.author = database.LookupStoreHacker('Unknown',
'unknown@hacker.net')
return S_DESC
m = patterns['author'].match(line)
if m:
patch.email = database.RemapEmail(m.group(2))
patch.author = database.LookupStoreHacker(m.group(1), patch.email)
else:
m = patterns['date'].match(line)
if m:
dt = rfc822.parsedate(m.group(2))
patch.date = datetime.date(dt[0], dt[1], dt[2])
return S_HEADER
示例2: search_SENTBEFORE
# 需要导入模块: import rfc822 [as 别名]
# 或者: from rfc822 import parsedate [as 别名]
def search_SENTBEFORE(self, query, id, msg):
"""
Returns C{True} if the message date is earlier than the query date.
@type query: A C{list} of C{str}
@param query: A list whose first element starts with a stringified date
that is a fragment of an L{imap4.Query()}. The date must be in the
format 'DD-Mon-YYYY', for example '03-March-2003' or '03-Mar-2003'.
@type id: C{int}
@param id: The sequence number of the message being checked.
@type msg: Provider of L{imap4.IMessage}
"""
date = msg.getHeaders(False, 'date').get('date', '')
date = rfc822.parsedate(date)
return date < parseTime(query.pop(0))
示例3: stat
# 需要导入模块: import rfc822 [as 别名]
# 或者: from rfc822 import parsedate [as 别名]
def stat(self, **kwargs):
"""Gets information about an object."""
url_endpoint, params, headers, _ = self._get_parameters(**kwargs)
resp = self.get_requests_session().head(
url_endpoint, params=params, headers=headers)
if resp.ok:
return location.LocationStat.from_keywords(
session=self._session,
location=self,
size=resp.headers["x-goog-stored-content-length"],
generation=resp.headers["x-goog-generation"],
created=arrow.Arrow(*(rfc822.parsedate(
resp.headers["Last-Modified"])[:7])).timestamp,
)
示例4: created_at_in_seconds
# 需要导入模块: import rfc822 [as 别名]
# 或者: from rfc822 import parsedate [as 别名]
def created_at_in_seconds(self):
""" Get the time this status message was posted, in seconds since
the epoch (1 Jan 1970).
Returns:
int: The time this status message was posted, in seconds since
the epoch.
"""
return timegm(parsedate(self.created_at))
示例5: search_BEFORE
# 需要导入模块: import rfc822 [as 别名]
# 或者: from rfc822 import parsedate [as 别名]
def search_BEFORE(self, query, id, msg):
date = parseTime(query.pop(0))
return rfc822.parsedate(msg.getInternalDate()) < date
示例6: search_ON
# 需要导入模块: import rfc822 [as 别名]
# 或者: from rfc822 import parsedate [as 别名]
def search_ON(self, query, id, msg):
date = parseTime(query.pop(0))
return rfc822.parsedate(msg.getInternalDate()) == date
示例7: search_SENTON
# 需要导入模块: import rfc822 [as 别名]
# 或者: from rfc822 import parsedate [as 别名]
def search_SENTON(self, query, id, msg):
"""
Returns C{True} if the message date is the same as the query date.
@type query: A C{list} of C{str}
@param query: A list whose first element starts with a stringified date
that is a fragment of an L{imap4.Query()}. The date must be in the
format 'DD-Mon-YYYY', for example '03-March-2003' or '03-Mar-2003'.
@type msg: Provider of L{imap4.IMessage}
"""
date = msg.getHeaders(False, 'date').get('date', '')
date = rfc822.parsedate(date)
return date[:3] == parseTime(query.pop(0))[:3]
示例8: search_SENTSINCE
# 需要导入模块: import rfc822 [as 别名]
# 或者: from rfc822 import parsedate [as 别名]
def search_SENTSINCE(self, query, id, msg):
"""
Returns C{True} if the message date is later than the query date.
@type query: A C{list} of C{str}
@param query: A list whose first element starts with a stringified date
that is a fragment of an L{imap4.Query()}. The date must be in the
format 'DD-Mon-YYYY', for example '03-March-2003' or '03-Mar-2003'.
@type msg: Provider of L{imap4.IMessage}
"""
date = msg.getHeaders(False, 'date').get('date', '')
date = rfc822.parsedate(date)
return date > parseTime(query.pop(0))
示例9: GetCreatedAtInSeconds
# 需要导入模块: import rfc822 [as 别名]
# 或者: from rfc822 import parsedate [as 别名]
def GetCreatedAtInSeconds(self):
'''Get the time this status message was posted, in seconds since the epoch.
Returns:
The time this status message was posted, in seconds since the epoch.
'''
return calendar.timegm(rfc822.parsedate(self.created_at))
示例10: search_SENTBEFORE
# 需要导入模块: import rfc822 [as 别名]
# 或者: from rfc822 import parsedate [as 别名]
def search_SENTBEFORE(self, query, id, msg):
date = msg.getHeader(False, 'date').get('date', '')
date = rfc822.parsedate(date)
return date < parseTime(query.pop(0))
示例11: search_SENTON
# 需要导入模块: import rfc822 [as 别名]
# 或者: from rfc822 import parsedate [as 别名]
def search_SENTON(self, query, id, msg):
date = msg.getHeader(False, 'date').get('date', '')
date = rfc822.parsedate(date)
return date[:3] == parseTime(query.pop(0))[:3]
示例12: search_SENTSINCE
# 需要导入模块: import rfc822 [as 别名]
# 或者: from rfc822 import parsedate [as 别名]
def search_SENTSINCE(self, query, id, msg):
date = msg.getHeader(False, 'date').get('date', '')
date = rfc822.parsedate(date)
return date > parseTime(query.pop(0))