Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

head file error, when server return '' content #23

Open
dawn110110 opened this issue Jun 29, 2021 · 0 comments
Open

head file error, when server return '' content #23

dawn110110 opened this issue Jun 29, 2021 · 0 comments

Comments

@dawn110110
Copy link

ut 里:
image

requests/models.py 901 行,里我加了些输出:

image

从第一个截图可以看出,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.

image

文件我是实际传上去了的.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant