Skip to content

Commit 4ef3d4f

Browse files
committed
'str' to '(str, bytes)'
1 parent 824162d commit 4ef3d4f

File tree

4 files changed

+16
-5
lines changed

4 files changed

+16
-5
lines changed

qencode3/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def x265_video_codec():
2929

3030
from . exeptions import QencodeClientException, QencodeTaskException
3131

32-
__version__ = "0.9.15"
32+
__version__ = "0.9.17"
3333
__status__ = "Beta"
3434
__author__ = "Qencode"
3535

qencode3/task.py

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,10 @@ def custom_start(self, data, **kwargs):
5353
self._create_task(1)
5454

5555
if not self.error:
56-
data = self._prepare_data_custom(self._prepare_query(data), **kwargs)
56+
query = self._prepare_query(data)
57+
58+
if not self.error:
59+
data = self._prepare_data_custom(query, **kwargs)
5760

5861
if not self.error and self.task_token:
5962
self._start_encode('start_encode2', data)
@@ -122,10 +125,18 @@ def _prepare_query(self, params):
122125
query = rm_key_if_null(params)
123126
return json.dumps(query)
124127

125-
if isinstance(params, str):
128+
if isinstance(params, (str, bytes)):
126129
if is_json(params):
127130
query = rm_key_if_null(params)
128131
return query
132+
else:
133+
self.error = True
134+
try:
135+
self.message = "JSON is not well formatted: {0} Is not defined".format(params)
136+
except Exception as e:
137+
pass
138+
finally:
139+
self.message = "JSON is not well formatted"
129140

130141
def _prepare_data_custom(self, query_json, **kwargs):
131142
data = dict(

qencode3/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ def rm_attributes_if_null(class_obj):
2929
def rm_key_if_null(obj):
3030
if isinstance(obj, dict):
3131
return _rm_key(obj)
32-
elif isinstance(obj, str):
32+
elif isinstance(obj, (str, bytes)):
3333
res = _rm_key(json.loads(obj))
3434
return json.dumps(res)
3535

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
setup(
1010
name='qencode3',
11-
version='0.9.15',
11+
version='0.9.17',
1212
description='Qencode Python SDK',
1313
url='https://github.com/qencode-dev/qencode-api-python3-client',
1414
# url=here,

0 commit comments

Comments
 (0)