本文整理匯總了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))