File and directory transfer over HTTP — Rust speed, Python convenience
Project description
eruspy-python
Python bindings for eruspy — file and directory transfer over HTTP, built with PyO3 and maturin.
Installation
pip install eruspy
Quick Start
Client
import eruspy
c = eruspy.EruspyClient("http://localhost:3000/transfer")
# Upload / download a file
c.upload("./file.txt", "file.txt")
c.download("file.txt", "./received.txt")
# Upload / download a directory
c.upload_dir("./my_folder", "my_folder")
c.download_dir("my_folder", "./restored")
# List a directory ("" = storage root)
entries = c.list("")
for e in entries:
kind = "DIR" if e.is_dir else "FILE"
print(f"[{kind}] {e.name} ({e.size} bytes)")
Server
run_server spawns a background Rust thread and returns immediately.
The server keeps the process alive until it exits.
import eruspy, time
eruspy.run_server("./storage", True, "0.0.0.0:3000")
# root dir ^ ^
# allow_list ─┘ └─ bind address
print("Server running. Press Ctrl+C to stop.")
try:
while True:
time.sleep(1)
except KeyboardInterrupt:
pass
API Reference
EruspyClient(base_url)
| Method | Description |
|---|---|
upload(local, remote) |
Upload a file. Parent dir must exist on server. |
download(remote, local) |
Download a file. |
upload_dir(local, remote) |
Upload a directory (zipped). Parent dir must exist on server. |
download_dir(remote, local) |
Download a directory (unzipped locally). |
list(remote_path) |
List a directory. Returns list[FileEntry]. |
FileEntry
| Attribute | Type | Description |
|---|---|---|
name |
str |
File or directory name |
is_dir |
bool |
True if directory |
size |
int |
Size in bytes (0 for directories) |
run_server(storage, allow_list, host)
Starts the server in a background Rust thread. Returns immediately.
| Parameter | Type | Description |
|---|---|---|
storage |
str |
Root directory for stored files (auto-created) |
allow_list |
bool |
Allow clients to call the /list endpoint |
host |
str |
Bind address, e.g. "0.0.0.0:3000" |
Building from Source
cd eruspy-python
python3 -m venv .venv
source .venv/bin/activate
pip install maturin
maturin develop # dev install into current venv
maturin build --release # produce a .whl for distribution
License
MIT OR Apache-2.0
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
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 eruspy-0.1.6-cp39-cp39-macosx_11_0_arm64.whl.
File metadata
- Download URL: eruspy-0.1.6-cp39-cp39-macosx_11_0_arm64.whl
- Upload date:
- Size: 5.4 MB
- Tags: CPython 3.9, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.9.6
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e003651084ede26f641c0193b551e4712d974cdf043fdf4a8dea41a2f5b383f7
|
|
| MD5 |
1f4297924a497f9e2a81427e7cbfb71b
|
|
| BLAKE2b-256 |
8217800918f5c41052e13888668731d83b8cac22b82de2152e8973058a910608
|