Skip to main content

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_listlist 数组。
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_archivecan_uploadcan_delete 等表示当前用户在该目录的权限。

更多说明(权限对应、测试、发布、上传方式与 roots 等)见 HELP.md

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

hfsapi-0.1.0.tar.gz (10.3 kB view details)

Uploaded Source

Built Distribution

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

hfsapi-0.1.0-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

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

Hashes for hfsapi-0.1.0.tar.gz
Algorithm Hash digest
SHA256 ee2a5aead82a2a557fc6ea3cfbfa76303ddb6add68b226cfc035c8bc53aebe5e
MD5 3e84eaf0355ec81cc32896143344ecfd
BLAKE2b-256 fafa7a525dcf9b99125b4f8bb3f3010d745b3305f9a9963b430efc2b455c0547

See more details on using hashes here.

Provenance

The following attestation bundles were made for hfsapi-0.1.0.tar.gz:

Publisher: publish.yml on xx025/hfsapi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for hfsapi-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 94dc859e69787efd5c64d0555bf195ce167d6fb6b8201b2258e126a63c09605b
MD5 c7e155266d9a9185bccffd8fb8e064ce
BLAKE2b-256 000b537765657a9f0b6db70f7292c8abb00fd641e39224598fd67b758ad69fad

See more details on using hashes here.

Provenance

The following attestation bundles were made for hfsapi-0.1.0-py3-none-any.whl:

Publisher: publish.yml on xx025/hfsapi

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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