Skip to content

Commit

Permalink
bugfix in JSONEncoder
Browse files Browse the repository at this point in the history
  • Loading branch information
GinTR1k committed Jul 14, 2020
1 parent 64e36d2 commit 4b9716e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ansq/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.0.12'
__version__ = '0.0.13'
9 changes: 4 additions & 5 deletions ansq/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@

class JSONEncoder(json.JSONEncoder):
def default(self, obj) -> str:
if isinstance(obj, Enum):
return obj.name
if isinstance(obj, datetime):
return obj.isoformat()
return json.JSONEncoder.default(self, obj)
try:
return convert_to_str(obj)
except TypeError:
return json.JSONEncoder.default(self, obj)


def get_host_port(uri: str) -> Tuple[str, Optional[int]]:
Expand Down

0 comments on commit 4b9716e

Please sign in to comment.