A small Baidu Netdisk tool.
Project description
bdpan
一个可复用的百度网盘(pan.baidu.com)小库,支持:
- 目录递归上传
- 分片并发上传(默认 4MB 分片、4 线程)
- 断点续传(本地保存 upload state)
- 创建分享链接(通过
api/filemetas获取fs_id)
安装
在本仓库中可直接:
pip install -e .
准备 cookies
需要登录后的 cookies(至少包含 BDUSS/STOKEN 等)。支持两种格式:
- 形如
key=value; key2=value2的 Cookie Header 文本 - 浏览器导出的 Netscape
cookies.txt
使用(库)
from bdpan import BaiduPanClient, BaiduPanConfig
client = BaiduPanClient(
BaiduPanConfig(
cookie_file="cookies.txt",
remote_root="/apps/bdpan",
state_dir="./data/bd_upload_state",
)
)
client.upload("local_folder_or_file")
link = client.share("remote_dir_name", password="1234", period_days=7)
print(link)
使用(命令行)
bdpan --cookie-file .\\auth\\baidu\\cookies.txt upload .\\data
bdpan --cookie-file .\\auth\\baidu\\cookies.txt share remote_dir --password 1234 --period-days 7
本地验证
python -m unittest discover -s tests -p "test_*.py"
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
bdpan-1.2.0.tar.gz
(11.7 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
bdpan-1.2.0-py3-none-any.whl
(11.9 kB
view details)
File details
Details for the file bdpan-1.2.0.tar.gz.
File metadata
- Download URL: bdpan-1.2.0.tar.gz
- Upload date:
- Size: 11.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
919fd16f0ef35823afa977d87b64482cae005df32f5c6169b5812deef249ad21
|
|
| MD5 |
ac099a8a2d7ef592ec44e8be3f94f041
|
|
| BLAKE2b-256 |
1427b999944c6ddf6981e73c2c3facf91e59e3efb119f1d6f5bd566ad3559281
|
File details
Details for the file bdpan-1.2.0-py3-none-any.whl.
File metadata
- Download URL: bdpan-1.2.0-py3-none-any.whl
- Upload date:
- Size: 11.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62688a6884d8afbc8a2e8b087220cf6118047ed9c8dc6bb16c4b018084b34626
|
|
| MD5 |
ced96dad8a0c70869a800f4ce3bf599a
|
|
| BLAKE2b-256 |
d18715a6db17d5fd29c3cca5c5cae4ef8d7cad014030e19ac179f8c021d13596
|