Skip to content

upload_file 上传文件错误 #102

Description

@xie-dd

我的代码是

from lanzou.api import LanZouCloud

lzy = LanZouCloud()
cookie = {'ylogin': '***', 'phpdisk_info': '***'}
print(lzy.login_by_cookie(cookie) == LanZouCloud.SUCCESS)
# can get True

code = lzy.upload_file(r"D:\\AAA.rar")
print(code)

能够正确登陆账户,也就是第一个print可以得到"True"
但是上传文件错误,错误代码如下:

Traceback (most recent call last):
  File "C:\Python38\lib\site-packages\requests\models.py", line 971, in json
    return complexjson.loads(self.text, **kwargs)
  File "C:\Python38\lib\json\__init__.py", line 357, in loads
    return _default_decoder.decode(s)
  File "C:\Python38\lib\json\decoder.py", line 337, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "C:\Python38\lib\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)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "W:\lanzouz_updata\main.py", line 8, in <module>
    code = lzy.upload_file(r"D:\\AAA.rar")
  File "C:\Python38\lib\site-packages\lanzou\api\core.py", line 929, in upload_file
    return self._upload_small_file(file_path, folder_id, callback=callback, uploaded_handler=uploaded_handler)
  File "C:\Python38\lib\site-packages\lanzou\api\core.py", line 789, in _upload_small_file
    file_list = self.get_file_list(folder_id)
  File "C:\Python38\lib\site-packages\lanzou\api\core.py", line 370, in get_file_list
    resp = resp.json()
  File "C:\Python38\lib\site-packages\requests\models.py", line 975, in json
    raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions