Commit 03ad0a2e authored by Josh Roesslein's avatar Josh Roesslein
Browse files

Added datetime parsing.

parent 5e270431
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
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment