Python rfc822.parsedate() Examples
The following are 16
code examples of rfc822.parsedate().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
rfc822
, or try the search function
.
Example #1
Source File: gitlog.py From integration with Apache License 2.0 | 6 votes |
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
Example #2
Source File: imap4.py From python-for-android with Apache License 2.0 | 6 votes |
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))
Example #3
Source File: cloud.py From rekall with GNU General Public License v2.0 | 5 votes |
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, )
Example #4
Source File: models.py From StockRecommendSystem with MIT License | 5 votes |
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))
Example #5
Source File: imap4.py From python-for-android with Apache License 2.0 | 5 votes |
def search_BEFORE(self, query, id, msg): date = parseTime(query.pop(0)) return rfc822.parsedate(msg.getInternalDate()) < date
Example #6
Source File: imap4.py From python-for-android with Apache License 2.0 | 5 votes |
def search_ON(self, query, id, msg): date = parseTime(query.pop(0)) return rfc822.parsedate(msg.getInternalDate()) == date
Example #7
Source File: imap4.py From python-for-android with Apache License 2.0 | 5 votes |
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]
Example #8
Source File: imap4.py From python-for-android with Apache License 2.0 | 5 votes |
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))
Example #9
Source File: twitter.py From python-for-android with Apache License 2.0 | 5 votes |
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))
Example #10
Source File: twitter.py From python-for-android with Apache License 2.0 | 5 votes |
def GetCreatedAtInSeconds(self): '''Get the time this direct message was posted, in seconds since the epoch. Returns: The time this direct message was posted, in seconds since the epoch. ''' return calendar.timegm(rfc822.parsedate(self.created_at))
Example #11
Source File: imap4.py From BitTorrent with GNU General Public License v3.0 | 5 votes |
def search_BEFORE(self, query, id, msg): date = parseTime(query.pop(0)) return rfc822.parsedate(msg.getInternalDate()) < date
Example #12
Source File: imap4.py From BitTorrent with GNU General Public License v3.0 | 5 votes |
def search_ON(self, query, id, msg): date = parseTime(query.pop(0)) return rfc822.parsedate(msg.getInternalDate()) == date
Example #13
Source File: imap4.py From BitTorrent with GNU General Public License v3.0 | 5 votes |
def search_SENTBEFORE(self, query, id, msg): date = msg.getHeader(False, 'date').get('date', '') date = rfc822.parsedate(date) return date < parseTime(query.pop(0))
Example #14
Source File: imap4.py From BitTorrent with GNU General Public License v3.0 | 5 votes |
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]
Example #15
Source File: imap4.py From BitTorrent with GNU General Public License v3.0 | 5 votes |
def search_SENTSINCE(self, query, id, msg): date = msg.getHeader(False, 'date').get('date', '') date = rfc822.parsedate(date) return date > parseTime(query.pop(0))
Example #16
Source File: models.py From Tautulli with GNU General Public License v3.0 | 5 votes |
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))