ufile-sdk-python
ufile-sdk-python copied to clipboard
head file error, when server return '' content
ut 里:
requests/models.py 901 行,里我加了些输出:
从第一个截图可以看出,head 请求返回的是 空串 ,然后当 json 解析报错了?
Traceback (most recent call last):
........
File "/opt/python_root/ins/lib/python3.9/site-packages/ufile/filemanager.py", line 421, in head_file
return _head_file(url, header)
File "/opt/python_root/ins/lib/python3.9/site-packages/ufile/httprequest.py", line 118, in _head_file
return __return_wraper(response)
File "/opt/python_root/ins/lib/python3.9/site-packages/ufile/httprequest.py", line 20, in __return_wraper
ret = {} if content_consumed else response.json() if isinstance(content_type, str) and content_type.startswith('application/json') else {}
File "/opt/python_root/ins/lib/python3.9/site-packages/requests/models.py", line 903, in json
return complexjson.loads(self.text, **kwargs)
File "/opt/python_root/ins/lib/python3.9/json/__init__.py", line 346, in loads
return _default_decoder.decode(s)
File "/opt/python_root/ins/lib/python3.9/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/opt/python_root/ins/lib/python3.9/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
测试代码截图:
self.s3 是我简单封装过的 ufile sdk.
文件我是实际传上去了的.