Python library for file download
Project description
filedownloader
multi thread file downloader/多线程文件下载器
intro
适用于大文件、网络时延大(但带宽充足)的情况
- 多线程分段下载
- 支持设置段大小
- 支持设置HTTP代理
- 支持断点续传
install
python setup.py install
or
pip install file_mt_downloader
how to use
1、Command Line
- 从URL下载到本地wechat.exe
python -m file_mt_downloader "https://dldir1.qq.com/weixin/Windows/WeChatSetup.exe" "wechat.exe"
- 断点续传 已经下载文件的一部分 异常中断 可接需下载
1、首次下载
通过break point file记录成功下载的数据段
python -m file_mt_downloader "target url" "save file" -bf "break point file"
2、从断开开始下载
从 break point file 读取历史下载段 计算缺失段接续下载
python -m file_mt_downloader "target url" "save file" -bf 'break point file' -b
more parameters
usage: __main__.py [-h] [-b] [-bf BREAKPOINT_FILE] [-d DATA] [-ds] [-H HEADER]
[-m METHOD] [-mr MAX_ERROR_RETRY] [-p PROXY] [-t TIMEOUT]
[-T THREAD] [-s SIZE]
url file
positional arguments:
url http url
file save file path
optional arguments:
-h, --help show this help message and exit
-b, --breakpoint from breakpoint
-bf BREAKPOINT_FILE, --breakpoint_file BREAKPOINT_FILE
break point file
-d DATA, --data DATA post data
-ds, --disable_segment
-H HEADER, --header HEADER
http header
-m METHOD, --method METHOD
http method
-mr MAX_ERROR_RETRY, --max_error_retry MAX_ERROR_RETRY
max error retry
-p PROXY, --proxy PROXY
http proxy
-t TIMEOUT, --timeout TIMEOUT
timeout
-T THREAD, --thread THREAD
download thread number
-s SIZE, --size SIZE segment size
2、Python Script
import requests
from file_mt_downloader import file_downloader
target_url = 'https://xxxx.xxx/xxx.exe'
save_path = 'xxx.exe'
ctl_args = {
'timeout': 60,
'proxies': {
'https': 'localhost:8080',
'http': 'localhost:8080',
}
}
request = requests.Request(url=target_url)
downloader = file_downloader.DownloaderCoordinator(save_path, request, ctl_args)
downloader.start().result()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file file_mt_downloader-1.0.0.tar.gz
.
File metadata
- Download URL: file_mt_downloader-1.0.0.tar.gz
- Upload date:
- Size: 7.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.53.0 CPython/3.7.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64620ea774edab39a7738439700ca574d5966a4f911a8fc28f822729b6e695e3 |
|
MD5 | 57a6b362ec0207b9f660b6b356eea7e1 |
|
BLAKE2b-256 | 1b4705027218306c4455cd4f82162d38c6029a492cfe46e446e93c24a6459104 |