Skip to main content

CLI for Tempserv - temporary file & site hosting

Project description

Tempserv CLI

A command-line interface for Tempserv - temporary file & site hosting on Cloudflare Workers.

Installation

pip install -e .

Or install from PyPI (once published):

pip install tempserv-cli

Quick Start

# Configure your tempserv instance
tempserv login https://tempserv.badman993944.workers.dev

# Upload a single file
tempserv upload photo.jpg

# Upload a folder (site mode)
tempserv upload ./my-website --mode site

# Upload with password protection
tempserv upload secret.pdf --password "mysecret"

# Upload with custom expiry
tempserv upload video.mp4 --expiry 6hr

# Download a file
tempserv download abc123

# View file info
tempserv info abc123

# Replace an existing file
tempserv replace abc123 new-version.jpg

# Delete a file
tempserv delete abc123

# List recent uploads
tempserv list

Commands

Command Description
tempserv login [URL] Configure tempserv instance URL
tempserv upload FILE Upload a file or folder
tempserv download SLUG Download a file
tempserv info SLUG View file metadata
tempserv delete SLUG Delete a file
tempserv replace SLUG FILE Replace an existing file
tempserv list Show recent uploads

Options

Upload Options

  • --mode, -m - Upload mode: file or site (auto-detected for folders)
  • --expiry, -e - Expiry time: 15min, 30min, 1hr, 2hr, 6hr, 12hr, 24hr, or custom minutes (1-1440)
  • --password, -p - Password protect the upload

Global Options

  • --url, -u - Override base URL for a single command
  • --json - Output in JSON format (for scripting)

Python API

from tempserv import upload, download, info, delete, replace

# Upload a file
result = upload("photo.jpg", expiry="1hr", password="secret")
print(result["url"])

# Download a file
download("abc123", output_path="./downloads/")

# Get file info
file_info = info("abc123")
print(file_info)

# Delete a file
delete("abc123", token="your-access-token")

# Replace a file
replace("abc123", "new-version.jpg", token="your-access-token")

Configuration

Config is stored in ~/.tempserv/config.json:

{
  "base_url": "https://tempserv.badman993944.workers.dev",
  "default_expiry": "1hr",
  "default_mode": "file",
  "recent_uploads": [
    {
      "slug": "abc123",
      "url": "https://tempserv.badman993944.workers.dev/file/abc123",
      "token": "XyZ12",
      "mode": "file",
      "uploaded_at": "2024-01-01T00:00:00",
      "expires_at": "2024-01-01T01:00:00"
    }
  ]
}

License

MIT

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

tempserv_cli-0.3.0.tar.gz (15.4 kB view details)

Uploaded Source

Built Distribution

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

tempserv_cli-0.3.0-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file tempserv_cli-0.3.0.tar.gz.

File metadata

  • Download URL: tempserv_cli-0.3.0.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for tempserv_cli-0.3.0.tar.gz
Algorithm Hash digest
SHA256 b9bb5c94545984c6b219d20eaccfe3b9945cf5193d3693c7c4d855a883cd2b5e
MD5 29fc0d1d1fc86c84b1b72b29275bace5
BLAKE2b-256 0a60b2dc05b0e395348af049c0e0d82d76b301842e93426c5a85038cf26a6a90

See more details on using hashes here.

File details

Details for the file tempserv_cli-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: tempserv_cli-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 15.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.2

File hashes

Hashes for tempserv_cli-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 25750233273471767215a242b9c29f964401ea6d1023a2d84c56c2e039628ca4
MD5 9cd581f6f7776c208fe200cbca85e3fc
BLAKE2b-256 0da58bca06458c5c53b374520ca2bfbcbf7aa328598db70e40213658bcbf0a8b

See more details on using hashes here.

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