Comments (10)
下载目录出问题是因为 #33 (comment) 现在已经修复了
api 是封装好的,只要 pip install lanzou-api
即可
但是闪退应该不至于,API是返回错误码的,不会抛异常
from lanzoucloud-api.
from lanzoucloud-api.
能贴一下代码嘛😀
from lanzoucloud-api.
from lanzou.api import LanZouCloud
def show_progress(file_name, total_size, now_size):
"""显示进度的回调函数"""
percent = now_size / total_size
bar_len = 40 # 进度条长总度
bar_str = '>' * round(bar_len * percent) + '=' * round(bar_len * (1 - percent))
print('\r{:.2f}%\t[{}] {:.1f}/{:.1f}MB | {} '.format(
percent * 100, bar_str, now_size / 1048576, total_size / 1048576, file_name), end='')
if total_size == now_size:
print('') # 下载完成换行
# ToDo 联网功能
print("已开始下载TAT2.7,下载文件存储在Download文件夹内")
lzy = LanZouCloud()
code = lzy.down_dir_by_url("https://wwa.lanzous.com/b05ahfwhc","","./Download",callback=show_progress)
if code == LanZouCloud.SUCCESS:
print("下载完成")
else:
print("遭遇错误,错误码:",code)
input()
from lanzoucloud-api.
1.确保使用的是最新的 API,昨天修复了文件夹链接判断的问题,目前版本是 2.5.4.1
2.有可能是网络不稳定的问题
from lanzoucloud-api.
看cmd截图,应该是
LanZouCloud-API/lanzou/api/core.py
Line 1017 in b064435
这一行的没有拿到数据得到的 None 直接进行 json 解析导致的闪退。
这种网络请求得不到数据还是比较常见的 Aruelius/cloud189#39
from lanzoucloud-api.
是的,所以说可能是网络问题,但是几乎没碰到过这个情况
我还是把 AttributeError 一起捕获好了,其它的方法都会先判断响应数据是否存在,这个方法很久之前就没有改动了,今天才出现问题哈哈
v2.5.4.2
已经把这个异常捕获,但是得到将会是 LanZouCloud.NETWORK_ERROR
而非文件夹信息
楼主可以试试换一下网络环境再试试~
from lanzoucloud-api.
from lanzoucloud-api.
json解析错误还是头一次出现,看样子是昨天植物大战僵尸的文件夹,但是我这边十分正常。
题主你是想做一个下载器对吧,可以分享一下完整的代码嘛,我这边测试一下。
如果需要,也可以远程协助~
from lanzoucloud-api.
依旧是down_dir_by_url方法的问题呀
那个代码压根儿没改
只是换成了从网络上获取url罢了
(url是绝对正确的)
from lanzoucloud-api.
Related Issues (20)
- 文件分割之后会被识别成相同文件
- 接口报错 json 解析出错 HOT 2
- upload_file 上传文件错误 HOT 3
- get_file_info_by_url ERROR - 'NoneType' object has no attribute 'group' HOT 2
- get_file_list提示请勿使用第三方工具未修复 HOT 1
- 解除限制后上传失败
- 建议出一个获取cookie数据的教程。不然小白不会 HOT 1
- 免滑块账号密码获取cookies HOT 4
- lzy.upload_file 上传方法无响应 HOT 4
- cookie登录失败?
- The file name in the result returned by `lzy.get_file_list` is blocked HOT 1
- 上传文件,名称被截断了 HOT 4
- 请求更新文件信息api/提醒"请忽使用第三方工具"的原因 HOT 1
- 使用api上传2-10M的压缩文件上传速度会差些吗?我再官方网页上上传文件,速度一般都有3-4M每秒!但是使用api上传后!我观察了很久,平均上传速度都是200-500k之间!就没有一次超过1M的!所以我想问下这是我网速问题还是说是文件上传程序就是这样的?
- lanzou is being installed using the legacy 'setup.py install' method
- 上传后的文件名怪怪的
- 大佬不准备更新了吗?
- get_dir_list 没法用了,会提示请忽使用第三方工具 HOT 8
- get_file_list 不能用了返回为空 看地址是加了post参数 但是参数应该怎么获取? HOT 2
- down_file_by_url 方法报错。提示 'NoneType' object has no attribute 'group' HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lanzoucloud-api.