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)
CLI
After pip install hfsapi, the hfs command is available. Log in once to save credentials locally; all other commands then use them (or pass --base-url if not logged in).
hfs login --base-url http://127.0.0.1:8280 -u abct -p abc123
hfs list /data
hfs upload ./local.txt --folder data
hfs upload ./mydir --folder data # folder: upload recursively
hfs mkdir data myfolder
hfs download data/foo.txt -o ./foo.txt
hfs delete data foo.txt
hfs config get
hfs vfs
hfs info
hfs logout
See hfs --help and hfs <command> --help for options.
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.
Legal: DISCLAIMER.md — no warranty, no liability, use at your own risk.
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.3.tar.gz.
File metadata
- Download URL: hfsapi-0.1.3.tar.gz
- Upload date:
- Size: 18.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2693715a08ceb388103b7c775a49d610de8ad43626a0868a59d53f3a0870d4ad
|
|
| MD5 |
673efd8cfacacd2a22a732f8b89337af
|
|
| BLAKE2b-256 |
5fa754684af36ca65531e5c0ce302456cb95f4da8ba458b3a8260d24544fca81
|
Provenance
The following attestation bundles were made for hfsapi-0.1.3.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.3.tar.gz -
Subject digest:
2693715a08ceb388103b7c775a49d610de8ad43626a0868a59d53f3a0870d4ad - Sigstore transparency entry: 892095624
- Sigstore integration time:
-
Permalink:
xx025/hfsapi@f18b33f97d722c45bfe6ff6ea5607ebcd96372a1 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/xx025
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f18b33f97d722c45bfe6ff6ea5607ebcd96372a1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file hfsapi-0.1.3-py3-none-any.whl.
File metadata
- Download URL: hfsapi-0.1.3-py3-none-any.whl
- Upload date:
- Size: 13.1 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 |
abc375ea79460972958c12c0f2963e96c5a16dae4694c763365f72922a2f9739
|
|
| MD5 |
27aadd9f200724456c8f4ac3942c6e23
|
|
| BLAKE2b-256 |
3db7e1290e88bc3d3406750877419a38b88ea83e36613d627cc1bd9a1a911712
|
Provenance
The following attestation bundles were made for hfsapi-0.1.3-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.3-py3-none-any.whl -
Subject digest:
abc375ea79460972958c12c0f2963e96c5a16dae4694c763365f72922a2f9739 - Sigstore transparency entry: 892095718
- Sigstore integration time:
-
Permalink:
xx025/hfsapi@f18b33f97d722c45bfe6ff6ea5607ebcd96372a1 -
Branch / Tag:
refs/tags/v0.1.3 - Owner: https://github.com/xx025
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@f18b33f97d722c45bfe6ff6ea5607ebcd96372a1 -
Trigger Event:
push
-
Statement type: