Skip to content

Commit

Permalink
Merge pull request #2 from komand/komand_additions
Browse files Browse the repository at this point in the history
Add get json serializable function
  • Loading branch information
mrinehart-r7 authored Oct 13, 2017
2 parents 7811088 + b447fb9 commit aa93d62
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 aa93d62

Please sign in to comment.