HFS (HTTP File Server) Python API 客户端
Project description
hfsapi
HFS (HTTP File Server) 的 Python API 客户端,支持登录、文件列表、上传、配置与权限相关操作。
安装
uv sync
# 或
pip install -e .
快速开始
from hfsapi import HFSClient, entry_size, entry_created, entry_modified
with HFSClient("http://127.0.0.1:8280", username="abct", password="abc123") as client:
data = client.get_file_list(uri="/data")
for e in data.get("list", []):
print(e["n"], entry_size(e), entry_created(e), entry_modified(e))
# 上传
client.upload_file("data", b"content", filename="hello.txt", use_put=True)
核心 API
| 方法 / 函数 | 说明 |
|---|---|
| HFSClient(base_url, username, password, timeout) | 客户端;建议用 with 或显式 close()。 |
| login() | 使用 URL 参数建立会话(与 Basic 二选一或配合使用)。 |
| get_file_list(uri, offset, limit, search, request_c_and_m) | 获取目录列表及当前用户在该目录的权限、条目元数据。 |
| list_entries(uri, ...) | 仅返回 get_file_list 的 list 数组。 |
| upload_file(folder, file_content, filename, use_put, put_params, use_session_for_put) | 上传文件到指定目录。 |
| delete_file(folder, filename) | 删除指定目录下的文件。 |
| get_config(only, omit) / set_config(values) | 读取/写入 HFS 配置;可改 VFS 与权限等。 |
| get_vfs() | 获取当前 VFS 树(含权限结构)。 |
| entry_size(e) / entry_created(e) / entry_modified(e) / entry_permissions(e) | 列表项元数据与权限缩写解析。 |
列表响应中:n 名称、s 大小、c/m 创建/修改时间;can_archive、can_upload、can_delete 等表示当前用户在该目录的权限。
更多说明(权限对应、测试、发布、上传方式与 roots 等)见 HELP.md。
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
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
File details
Details for the file hfsapi-0.1.0.tar.gz.
File metadata
- Download URL: hfsapi-0.1.0.tar.gz
- Upload date:
- Size: 10.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ee2a5aead82a2a557fc6ea3cfbfa76303ddb6add68b226cfc035c8bc53aebe5e
|
|
| MD5 |
3e84eaf0355ec81cc32896143344ecfd
|
|
| BLAKE2b-256 |
fafa7a525dcf9b99125b4f8bb3f3010d745b3305f9a9963b430efc2b455c0547
|
Provenance
The following attestation bundles were made for hfsapi-0.1.0.tar.gz:
Publisher:
publish.yml on xx025/hfsapi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hfsapi-0.1.0.tar.gz -
Subject digest:
ee2a5aead82a2a557fc6ea3cfbfa76303ddb6add68b226cfc035c8bc53aebe5e - Sigstore transparency entry: 891554516
- Sigstore integration time:
-
Permalink:
xx025/hfsapi@10975a079d104d53f6c644083891f78878aa60f8 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/xx025
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@10975a079d104d53f6c644083891f78878aa60f8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file hfsapi-0.1.0-py3-none-any.whl.
File metadata
- Download URL: hfsapi-0.1.0-py3-none-any.whl
- Upload date:
- Size: 7.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
94dc859e69787efd5c64d0555bf195ce167d6fb6b8201b2258e126a63c09605b
|
|
| MD5 |
c7e155266d9a9185bccffd8fb8e064ce
|
|
| BLAKE2b-256 |
000b537765657a9f0b6db70f7292c8abb00fd641e39224598fd67b758ad69fad
|
Provenance
The following attestation bundles were made for hfsapi-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on xx025/hfsapi
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
hfsapi-0.1.0-py3-none-any.whl -
Subject digest:
94dc859e69787efd5c64d0555bf195ce167d6fb6b8201b2258e126a63c09605b - Sigstore transparency entry: 891554581
- Sigstore integration time:
-
Permalink:
xx025/hfsapi@10975a079d104d53f6c644083891f78878aa60f8 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/xx025
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@10975a079d104d53f6c644083891f78878aa60f8 -
Trigger Event:
push
-
Statement type: