Skip to main content

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"

Metadata

Release files for bdpan 1.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for bdpan 1.5.0
File Size Uploaded Provenance Actions
bdpan-1.5.0.tar.gz 11.7 kB Without provenance Details for bdpan-1.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for bdpan 1.5.0
File Interpreter ABI Platform Actions
bdpan-1.5.0-py3-none-any.whl Python 3 none any Details for bdpan-1.5.0-py3-none-any.whl

Total release size: 23.6 kB

Release files / bdpan-1.5.0.tar.gz

Download URL bdpan-1.5.0.tar.gz
Size 11.7 kB
Tags Source
SHA-256 checksum
How to use checksums
bbb9d6445192cf37afaf09a30129f343df7dd598bf0157c051806883e41c0ef9
BLAKE2b-256 checksum
How to use checksums
49d9b3bacf9f0611375fb3ec4f3d9332b2c27abd2b0e4211c7fa31cd5eacd5b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Release files / bdpan-1.5.0-py3-none-any.whl

Download URL bdpan-1.5.0-py3-none-any.whl
Size 11.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
41d5f43cee9f58acca1fed43d2e8d7541cd360f3ba0d779a5b879034a454bea9
BLAKE2b-256 checksum
How to use checksums
7ec871c868ba5c51740186458e1a8218f6235798a3a571ff0019795f995e0643
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.7

Security for bdpan 1.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page