funget
Project description
Funget
一个高效的 Python 文件下载和上传工具,支持多线程下载和断点续传功能。
特性
- 🚀 多线程下载: 支持多线程并发下载,提高下载速度
- 📁 断点续传: 支持断点续传,避免重复下载
- 🔧 灵活配置: 可自定义线程数、块大小等参数
- 📤 文件上传: 支持文件上传功能
- 🖥️ 命令行工具: 提供便捷的命令行接口
- 📦 Python API: 提供完整的 Python API 接口
安装
pip install funget
快速开始
命令行使用
# 基本下载
funget https://example.com/file.zip
# 自定义参数
funget https://example.com/file.zip --worker 20 --block-size 200 --capacity 150
Python API
下载文件
from funget import multi_thread_download, simple_download
# 多线程下载(推荐)
multi_thread_download(
url="https://example.com/file.zip",
filepath="./downloads/file.zip",
worker_num=10,
block_size=100,
capacity=100
)
# 简单下载
simple_download(
url="https://example.com/file.zip",
filepath="./downloads/file.zip"
)
上传文件
from funget import single_upload
# 上传文件
single_upload(
file_path="./local_file.txt",
upload_url="https://upload.example.com/api"
)
API 参考
下载函数
multi_thread_download(url, filepath=None, worker_num=10, block_size=100, capacity=100)
多线程下载文件
参数:
url(str): 下载链接filepath(str, optional): 保存路径,默认为当前目录下的文件名worker_num(int): 工作线程数,默认 10block_size(int): 每个块的大小(KB),默认 100capacity(int): 队列容量,默认 100
simple_download(url, filepath=None)
单线程下载文件
参数:
url(str): 下载链接filepath(str, optional): 保存路径
download(url, filepath=None, **kwargs)
通用下载函数,自动选择最佳下载方式
上传函数
single_upload(file_path, upload_url, **kwargs)
上传单个文件
参数:
file_path(str): 本地文件路径upload_url(str): 上传接口地址
命令行参数
funget [URL] [OPTIONS]
选项:
--worker INTEGER: 工作线程数(默认: 10)--block-size INTEGER: 块大小,单位 KB(默认: 100)--capacity INTEGER: 队列容量(默认: 100)
使用示例
下载大文件
from funget import multi_thread_download
# 下载大文件,使用 20 个线程
multi_thread_download(
url="https://releases.ubuntu.com/20.04/ubuntu-20.04.6-desktop-amd64.iso",
filepath="./ubuntu.iso",
worker_num=20,
block_size=1024 # 1MB 块大小
)
批量下载
from funget import multi_thread_download
urls = [
"https://example.com/file1.zip",
"https://example.com/file2.zip",
"https://example.com/file3.zip"
]
for i, url in enumerate(urls):
print(f"下载文件 {i+1}/{len(urls)}")
multi_thread_download(url, filepath=f"./downloads/file_{i+1}.zip")
依赖
- Python >= 3.7
- funfile >= 1.0.15
- typer-slim >= 0.15.2
许可证
本项目基于 MIT 许可证开源。
作者
- niuliangtao - farfarfun@qq.com
贡献
欢迎提交 Issue 和 Pull Request 来改进这个项目!
更新日志
v1.0.46
- 当前稳定版本
- 支持多线程下载和文件上传
- 提供命令行工具和 Python API
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
funget-1.0.48.tar.gz
(18.2 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
funget-1.0.48-py3-none-any.whl
(21.4 kB
view details)
File details
Details for the file funget-1.0.48.tar.gz.
File metadata
- Download URL: funget-1.0.48.tar.gz
- Upload date:
- Size: 18.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bda7db2b0fc1f0a3b6fbdde0c4dc3f60981b041a9d3c18dd7773755e660e70a4
|
|
| MD5 |
3e10f18857e62ceb05ab2aece51382d9
|
|
| BLAKE2b-256 |
71622464471d5d3054bd57197a174d1baa3d32408104fd8df0650f150d069598
|
File details
Details for the file funget-1.0.48-py3-none-any.whl.
File metadata
- Download URL: funget-1.0.48-py3-none-any.whl
- Upload date:
- Size: 21.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.10.2 {"installer":{"name":"uv","version":"0.10.2","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a99aaf26b92adaf84cabd998c23b604a83040f476a663f01dacbecaf01137c92
|
|
| MD5 |
9018223bcf6c4b925c0d5a218a8ebc80
|
|
| BLAKE2b-256 |
18ed73c63bf8d88106814cbee2aa655ebc0f761903d106358b4ffea72dd293b0
|