Skip to content

add resumable download file #122

New issue

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

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

Already on GitHub? # to your account

Merged
merged 14 commits into from
Aug 10, 2020
Merged

add resumable download file #122

merged 14 commits into from
Aug 10, 2020

Conversation

jayzhenghan
Copy link
Contributor

No description provided.

ut/test.py Outdated
@@ -1164,6 +1164,10 @@ def _test_get_object_sensitive_content_recognition():
print(response)
assert response

def test_download_file():
"""测试断点续传下载接口"""
client.download_file(test_bucket, test_object, 'test_download_file.local')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ut建议加上md5校验,确保下载的文件的正确性

@@ -2942,6 +2943,30 @@ def _check_all_upload_parts(self, bucket, key, uploadid, local_path, parts_num,
already_exist_parts[part_num] = part['ETag']
return True

def download_file(self, Bucket, Key, DestFilePath, PartSize=20, MAZThread=5, EnableCRC=False, **Kwargs):
"""小于等于20MB的文件简单上传,大于20MB的文件使用分块上传
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

注释不对

:param key(string): 分块上传路径名.
:param LocalFilePath(string): 本地文件路径名.
:param PartSize(int): 分块的大小设置,单位为MB.
:param MAXThread(int): 并发上传的最大线程数.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment

pool.wait_completion()
result = pool.get_result()
if not result['success_all']:
raise CosClientError('some upload_part fail after max_retry, please upload_file again')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

check

@dt3310321
Copy link
Contributor

LGTM

@dt3310321 dt3310321 merged commit 49197ca into tencentyun:master Aug 10, 2020
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants