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 | def extract_dates(obj): |
|
30 | def extract_dates(obj): | |
31 | """extract ISO8601 dates from unpacked JSON""" |
|
31 | """extract ISO8601 dates from unpacked JSON""" | |
32 | if isinstance(obj, dict): |
|
32 | if isinstance(obj, dict): | |
|
33 | obj = dict(obj) # don't clobber | |||
33 | for k,v in obj.iteritems(): |
|
34 | for k,v in obj.iteritems(): | |
34 | obj[k] = extract_dates(v) |
|
35 | obj[k] = extract_dates(v) | |
35 | elif isinstance(obj, (list, tuple)): |
|
36 | elif isinstance(obj, (list, tuple)): | |
@@ -42,6 +43,7 b' def extract_dates(obj):' | |||||
42 | def squash_dates(obj): |
|
43 | def squash_dates(obj): | |
43 | """squash datetime objects into ISO8601 strings""" |
|
44 | """squash datetime objects into ISO8601 strings""" | |
44 | if isinstance(obj, dict): |
|
45 | if isinstance(obj, dict): | |
|
46 | obj = dict(obj) # don't clobber | |||
45 | for k,v in obj.iteritems(): |
|
47 | for k,v in obj.iteritems(): | |
46 | obj[k] = squash_dates(v) |
|
48 | obj[k] = squash_dates(v) | |
47 | elif isinstance(obj, (list, tuple)): |
|
49 | elif isinstance(obj, (list, tuple)): |
General Comments 0
You need to be logged in to leave comments.
Login now