Skip to content

Commit

Permalink
Add get json serializable function
Browse files Browse the repository at this point in the history
  • Loading branch information
mrinehart-r7 committed Oct 13, 2017
1 parent aee6cc6 commit b447fb9
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions whois/_3_adjust.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,17 @@ def __init__(self, data):
except KeyError:
pass

def get_json_serializable(self):
properties = self.__dict__

for key in properties:
if type(properties[key]) is datetime.datetime:
properties[key] = properties[key].isoformat()
if type(properties[key]) is set:
properties[key] = list(properties[key])

return properties


# http://docs.python.org/library/datetime.html#strftime-strptime-behavior
DATE_FORMATS = [
Expand Down

0 comments on commit b447fb9

Please sign in to comment.