Skip to main content

xes-assets

零依赖下载器 / Zero-dependency downloader for the XES Python course asset files:

  • https://livefile.xesimg.com/programme/python_assets/3f51c62b04d3aacc27b0d53f294ecc3b.rar
  • https://livefile.xesimg.com/programme/python_assets/a3635617bd88675041ba69f8398df5a0.zip

只用 Python 标准库(urllib、hashlib、zipfile),没有任何第三方依赖。 Uses nothing but the Python standard library — no third-party dependency at all.

安装 / Install

pip install xes-assets

命令行 / CLI

xes-assets --list                        # 查看两个文件的信息
xes-assets zip -d D:\xes                 # 下载 ZIP
xes-assets all -d D:\xes -x              # 下载两个并解压
xes-assets rar --verify-only -d D:\xes   # 只校验已下载文件
python -m xes_assets all -d D:\xes       # 等价写法
参数 说明
ASSET(位置参数) rar、zip、all、文件名或 URL;省略时等于 all
-d, --dest DIR 输出目录(默认当前目录)
-x, --extract 下载后解压(RAR 需要外部解压工具,见下)
-f, --overwrite 覆盖已存在文件
--no-verify 跳过 SHA-256 校验
-q, --quiet 不显示进度
--verify-only 只校验不下载
--list 列出已知文件

Python API

from xes_assets import ASSETS, download, download_all, extract, verify

download("zip", r"D:\xes")            # -> Path,含大小 + SHA-256 校验
download_all(r"D:\xes")               # 两个都下
verify("rar", r"D:\xes")              # -> True/False
extract("zip", r"D:\xes")             # 标准库解压,返回目录
extract("rar", r"D:\xes")             # 需外部 7z / UnRAR(见下)

单个函数的行为:

  • download(key, dest=".", *, overwrite=False, verify_checksum=True, progress=None, timeout=60, retries=3) 先写 <文件名>.part,校验大小与 SHA-256 通过后才原子改名为正式文件;断点续传用 HTTP Range (服务器返回 206 时继续,否则从头开始),网络中断自动重试。
  • download_all(dest=".", *, keys=None, **kwargs) → List[Path]
  • extract(key, dest=None, *, archive=None, overwrite=False) → 解压目录 Path
  • verify(key, path=None, dest=".") → bool
  • asset_path(key, dest=".") → 预期的本地路径
  • ASSETS / ASSET_ORDER 为元数据常量;XesAssetError 为统一异常

文件与校验值 / Files

key 文件名 大小 SHA-256
rar 3f51c62b04d3aacc27b0d53f294ecc3b.rar 568,456,521 B ea41b34bd193cf0039386c0cfe22f93c2225bb43ef01d69740106a35e05d7c85
zip a3635617bd88675041ba69f8398df5a0.zip 39,463,900 B 63fdddb6c37849606ae32d08e522bbd2a627be90971005946b6c332a7715ff93

校验值在主文件被上游替换前一直有效;上游变更时下载会明确报 checksum mismatch (不会静默留下坏文件)。

关于 RAR 解压 / About RAR extraction

下载永远只需要标准库。解压 .rar 时本包会依次查找 7z / 7zz / 7za / unrar / unar / bsdtar(PATH 中或常见安装路径 C:\Program Files\7-Zip\7z.exe、C:\Program Files\WinRAR\UnRAR.exe), 找不到就抛 XesAssetError 并提示手工解压。ZIP 解压完全由标准库完成。

License

MIT

Metadata

Release files for xes-assets 1.0.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 xes-assets 1.0.0
File Size Uploaded
xes_assets-1.0.0.tar.gz 11.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for xes-assets 1.0.0
File Interpreter ABI Platform
xes_assets-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 22.6 kB

Release files / xes_assets-1.0.0.tar.gz

Download URL xes_assets-1.0.0.tar.gz
Size 11.7 kB
Tags Source
SHA-256 checksum
How to use checksums
bb14f8eeb185310b36517353452b0f5478fbd06f9757be2912a3301d40ec0391
BLAKE2b-256 checksum
How to use checksums
d8ea7cde71d67dfdd4c3aabf56ced6c4f32c1c1be4dd6e667ee500a2a0106912
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.9

Release files / xes_assets-1.0.0-py3-none-any.whl

Download URL xes_assets-1.0.0-py3-none-any.whl
Size 10.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
f22ba1601a38fdb16c40294b5a68089d1177ac1c9de3b262ab82cac9d651e9f5
BLAKE2b-256 checksum
How to use checksums
a41677da72a2e79d28be18df5f57fc148fc6b8eb2e28f526563830cb9deac886
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.9

Release history Release notifications | RSS feed

1.1.0

2 release files

This release

1.0.0 This release

2 release files

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