Show More
@@ -30,6 +30,7 b' ISO8601_PAT=re.compile(r"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d+$")' | |||
|
30 | 30 | def extract_dates(obj): |
|
31 | 31 | """extract ISO8601 dates from unpacked JSON""" |
|
32 | 32 | if isinstance(obj, dict): |
|
33 | obj = dict(obj) # don't clobber | |
|
33 | 34 | for k,v in obj.iteritems(): |
|
34 | 35 | obj[k] = extract_dates(v) |
|
35 | 36 | elif isinstance(obj, (list, tuple)): |
@@ -42,6 +43,7 b' def extract_dates(obj):' | |||
|
42 | 43 | def squash_dates(obj): |
|
43 | 44 | """squash datetime objects into ISO8601 strings""" |
|
44 | 45 | if isinstance(obj, dict): |
|
46 | obj = dict(obj) # don't clobber | |
|
45 | 47 | for k,v in obj.iteritems(): |
|
46 | 48 | obj[k] = squash_dates(v) |
|
47 | 49 | elif isinstance(obj, (list, tuple)): |
General Comments 0
You need to be logged in to leave comments.
Login now