httplib2在python中下载进度条
使用 httplib2 时,是否可以在 python 中显示文件下载的百分比?我知道你可以使用 urllib2 但我想使用 httplib2。
Is it possible to display the percentage a file has downloaded in python while using httplib2? I know you can with urllib2 but I want to use httplib2.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
不会。
httplib2
没有任何类型的进度信标回调,因此它只是阻塞,直到请求完成。No.
httplib2
doesn't have any kind of progress beacon callback, so it simply blocks until the request is finished.我不太确定如何使用 async()
看来已经正式解决了。
您可以自行修改httplib2:
(将回调函数arg添加到request()函数中)
在类中Http:
in def _request: 修改为:
in def _conn_requst: 修改为:
修改如下
使用时
:前8192为块大小,callbackfunc为回调您定义的函数(如 urllib 中)
i'm not very sure with how to use async()
seems it's already OFFICIALLY solved.
and it's possible to modify httplib2 by your self:
(add a callback function arg to the request() func)
in class Http:
in def _request: modify it to:
in def _conn_requst: modify it to:
modify this below
when use you can type like this:
the first 8192 is chunk size, and callbackfunc is the callback function you defined(like in urllib)