From 8f56fc119d03eb40cf147cf6261e7bf2a59dd050 Mon Sep 17 00:00:00 2001 From: kpsoft Date: Sat, 7 Sep 2019 19:24:15 +0800 Subject: [PATCH] add bytes type decode process --- redisgraph/query_result.py | 7 ++++++- redisgraph/util.py | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/redisgraph/query_result.py b/redisgraph/query_result.py index b37e21e..b0c6bda 100644 --- a/redisgraph/query_result.py +++ b/redisgraph/query_result.py @@ -129,7 +129,12 @@ def parse_scalar(self, cell): scalar = None elif scalar_type == ResultSetScalarTypes.VALUE_STRING: - scalar = str(value) + if isinstance(value, bytes): + scalar = value.decode() + elif not isinstance(value, str): + scalar = str(value) + else: + scalar = value elif scalar_type == ResultSetScalarTypes.VALUE_INTEGER: scalar = int(value) diff --git a/redisgraph/util.py b/redisgraph/util.py index d570d59..c7250f0 100644 --- a/redisgraph/util.py +++ b/redisgraph/util.py @@ -13,7 +13,10 @@ def quote_string(v): quote_string wraps given v with quotes incase v is a string. """ - if not isinstance(v, str): + + if isinstance(v, bytes): + v = v.decode() + elif not isinstance(v, str): return v if v[0] != '"':