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

希望sdk能够给上传文件,加个进度条显示 #109

Open
Seifon opened this issue Feb 25, 2023 · 3 comments
Open

希望sdk能够给上传文件,加个进度条显示 #109

Seifon opened this issue Feb 25, 2023 · 3 comments

Comments

@Seifon
Copy link

Seifon commented Feb 25, 2023

如题

可以使用:tqdm 这个python库实现

img

@PeterDing
Copy link
Owner

upload 命令默认是开启进度条的。你用的是什么命令。

@Seifon
Copy link
Author

Seifon commented Feb 25, 2023

baidupan.upload_file(io=io, remotepath=remote_file_path)

@PeterDing
Copy link
Owner

进度条属于外部功能,BaiduPCSApi.upload_file 不提供,你可以仿照下面的代码,自己实现。

def callback_for_slice(monitor: MultipartEncoderMonitor):
if task_id is not None and progress_task_exists(task_id):
_progress.update(task_id, completed=slice_completed + monitor.bytes_read)

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

2 participants