Mercurial > bzapi
changeset 9:bac306ebd2da
more accurate updating for bugzilla.mozilla.org
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Wed, 23 Dec 2009 15:14:22 -0800 |
parents | 9ca705d18849 |
children | 2731713f61a8 |
files | bzapi.py |
diffstat | 1 files changed, 10 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/bzapi.py Wed Dec 23 15:05:16 2009 -0800 +++ b/bzapi.py Wed Dec 23 15:14:22 2009 -0800 @@ -109,6 +109,8 @@ raise ValueError(msg) def get(self, url, **kwargs): + now = datetime.utcnow().replace(microsecond=0) + for name, value in kwargs.items(): if isinstance(value, datetime): kwargs[name] = datetime_to_iso(value) @@ -134,5 +136,12 @@ response = urllib2.urlopen(request) + # TODO: instead of 'now', we'd like to use the 'Date' + # HTTP header, but it's actually completely wrong in + # the case of bugzilla.mozilla.org, so we'll assume + # our timekeeping is better. + + #'date': datetime_from_rfc1123(response.info()['Date'])} + return {'data': json.loads(response.read()), - 'date': datetime_from_rfc1123(response.info()['Date'])} + 'date': now}