projects
/
tweepy.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5e27043
)
Added datetime parsing.
author
Josh Roesslein
<jroesslein@gmail.com>
Mon, 6 Jul 2009 00:34:46 +0000
(19:34 -0500)
committer
Josh Roesslein
<jroesslein@gmail.com>
Mon, 6 Jul 2009 00:34:46 +0000
(19:34 -0500)
parsers.py
patch
|
blob
|
blame
|
history
diff --git
a/parsers.py
b/parsers.py
index 8330b846e94baea1fb5b00d6ceb38f92f2bfd9b8..b8866fcabb5b5a61461a477a4b09839e34eca5cc 100644
(file)
--- a/
parsers.py
+++ b/
parsers.py
@@
-1,3
+1,5
@@
+from datetime import datetime
+
try:
import json
except ImportError:
@@
-7,6
+9,10
@@
def parse_error(data):
return json.loads(data)['error']
+def _parse_datetime(str):
+
+ return datetime.strptime(str, '%a %b %d %H:%M:%S +0000 %Y')
+
def _parse_user(obj, classes):
user = classes['user']()
@@
-27,6
+33,8
@@
def _parse_status(obj, classes):
for k,v in obj.items():
if k == 'user':
setattr(status, k, _parse_user(v, classes))
+ elif k == 'created_at':
+ setattr(status, k, _parse_datetime(v))
else:
setattr(status, k, v)
return status