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.1a1.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.1a1-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file hfsapi-0.1.1a1.tar.gz.

File metadata

  • Download URL: hfsapi-0.1.1a1.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.1a1.tar.gz
Algorithm Hash digest
SHA256 3ff9307fbe5853aac0f0aab28c0a7459395b2ff15fe149f1463e9ab055611934
MD5 abb55eb23e9b8f829aef2a82ae20c74c
BLAKE2b-256 5985e72c1b427c3cebae72cf1070f44e6abd14fc39a4054c921d46f2a1e10b18

See more details on using hashes here.

Provenance

The following attestation bundles were made for hfsapi-0.1.1a1.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.1a1-py3-none-any.whl.

File metadata

  • Download URL: hfsapi-0.1.1a1-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.1a1-py3-none-any.whl
Algorithm Hash digest
SHA256 ea8d2f3d4b199fed967f023ae80622ef271c5d678f223ea714a337b5a85fa381
MD5 79742863d8193ffd5b21a5a4f3289caa
BLAKE2b-256 6c00f256888fba30b854163ffb39c986387b1d21239b2f54ec217b0d31ff913a

See more details on using hashes here.

Provenance

The following attestation bundles were made for hfsapi-0.1.1a1-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