From bfafc89574f5d7536882065022d070c573879913 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=81=A5=E5=81=A5?= Date: Tue, 10 Nov 2020 20:34:32 +0800 Subject: [PATCH] remove encoding = 'utf-8' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 如果没有安装 simplejson,默认使用 json,在执行 fetch 时,__return_wrapper 中使用 encoding='utf-8',会导致 TypeError: __init__() got an unexpected keyword argument 'encoding' --- qiniu/http.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/qiniu/http.py b/qiniu/http.py index 9cc6e619..55a53fc0 100644 --- a/qiniu/http.py +++ b/qiniu/http.py @@ -23,7 +23,7 @@ def __return_wrapper(resp): if resp.status_code != 200 or resp.headers.get('X-Reqid') is None: return None, ResponseInfo(resp) resp.encoding = 'utf-8' - ret = resp.json(encoding='utf-8') if resp.text != '' else {} + ret = resp.json() if resp.text != '' else {} if ret is None: # json null ret = {} return ret, ResponseInfo(resp)