Skip to main content

HFS (HTTP File Server) Python API 客户端

Project description

hfsapi

English | 中文

Python API client for HFS (HTTP File Server): login, file listing, upload, config, and permissions.

Install

From PyPI (recommended):

pip install hfsapi
# or
uv add hfsapi

From source:

uv sync
# or
pip install -e .

Quick start

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))

    # Create folder (same as “New folder” in the web UI)
    client.create_folder("data", "myfolder")

    # Upload
    client.upload_file("data", b"content", filename="hello.txt", use_put=True)

Core API

Method / function Description
HFSClient(base_url, username, password, timeout) Client; use with or call close() when done.
login() Establish session via URL params (alternative or complement to Basic auth).
get_file_list(uri, offset, limit, search, request_c_and_m) Get directory listing, current user permissions, and entry metadata.
list_entries(uri, ...) Returns only the list array from get_file_list.
upload_file(folder, file_content, filename, use_put, put_params, use_session_for_put) Upload a file to the given folder.
create_folder(parent_folder, new_name, use_put) Create a new folder under the parent (same as “New folder” in the web UI).
delete_file(folder, filename) Delete a file under the given folder.
get_config(only, omit) / set_config(values) Read/write HFS config; e.g. VFS and permissions.
get_vfs() Get current VFS tree (including permission structure).
entry_size(e) / entry_created(e) / entry_modified(e) / entry_permissions(e) Helpers for list entry metadata and permission abbreviations.

In list responses: n = name, s = size, c/m = created/modified time; can_archive, can_upload, can_delete, etc. indicate the current user’s permissions for that directory.

More details (permission mapping, testing, publishing, upload options and roots) in 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.1.tar.gz (11.4 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.1-py3-none-any.whl (8.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: hfsapi-0.1.1.tar.gz
  • Upload date:
  • Size: 11.4 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.1.tar.gz
Algorithm Hash digest
SHA256 66fc145afa6b58fea95e64633e1e50cba6c810ae7bc58086b8c69329f4437627
MD5 43af6fba2bcd5962b85ee79bd58c5765
BLAKE2b-256 5c21f3e62d134fee325b1fb37c832cb1d405c13413079f0866b6e9a454914880

See more details on using hashes here.

Provenance

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

File metadata

  • Download URL: hfsapi-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 8.1 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 756c35c85985f2b5089453ef392c865c7b1abd97ad2a7019b293b1a3aa04bf7a
MD5 1eee81941dfdf38d615a027424e4be16
BLAKE2b-256 b53f47a959d9cc9d1ac2d93c6560d4bb728b2adeec2c2e52292188c07b6771d0

See more details on using hashes here.

Provenance

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