Skip to main content

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",
        bypy_config_dir="./auth/baidu",
        remote_root="/apps/bypy",
        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-0.1.0.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

bdpan-0.1.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

File details

Details for the file bdpan-0.1.0.tar.gz.

File metadata

  • Download URL: bdpan-0.1.0.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for bdpan-0.1.0.tar.gz
Algorithm Hash digest
SHA256 321f5e8f11090a69936627d97e84a92d2e04b4ad952f740ef4766edc640868e6
MD5 130b743551f258662c2578224c650c00
BLAKE2b-256 2a398a2d95cda94db275e892cbffd3115b82ab743750cb39ed86634e27004c9c

See more details on using hashes here.

File details

Details for the file bdpan-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: bdpan-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 10.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for bdpan-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4d9332fa72613b63acc4c9c65c7bf69a3985df6968c528797e7586f3b5ef997c
MD5 f3bd621a684a72f140c1d592ad970d96
BLAKE2b-256 0e01823c8162257ad21af33869be018b86f143626da26117818521d145341e65

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page