Skip to main content

html-previewer (Python client)

Cross-platform command-line client and library for html-previewer — a self-hosted service that publishes short-lived HTML previews behind unguessable capability URLs, with automatic expiry and disk reclaim.

Works on Linux, macOS and Windows. Pure stdlib — zero runtime dependencies. It is a faithful, feature-complete port of the classic preview-publish.sh, so existing habits and scripts carry over.

Install

pip install html-previewer

This installs the preview-publish command (alias: html-previewer).

Configure

Point the client at your server once:

preview-publish --base https://preview.example.com --key YOUR_API_KEY --save-config

Or just export the variables: PREVIEW_API_BASE and PREVIEW_API_KEY (equivalently, put PREVIEW_API_KEY=… lines in the config file — ~/.config/preview/config on Linux/macOS, %APPDATA%\preview\config on Windows; the same shell-style file the bash client reads).

Use

preview-publish ./site/ my-site 14      # publish a folder, 14-day expiry
preview-publish ./report.zip            # publish a zip (topic from filename)
preview-publish ./page.html             # publish a single html page
preview-publish ./site/ my-site 2m      # short-lived: 2 minutes
preview-publish --dry-run ./site/ my    # predict: update in place, or new URL?
preview-publish --new ./site/ my-site   # force a brand-new URL
preview-publish --list                  # list live previews (--list-all: everything)
preview-publish --info <hash>           # one preview's record
preview-publish --delete <hash>         # reclaim now
preview-publish --expiry <hash> --action extend --days 30
preview-publish --open ./site/ my-site  # publish, then open in a browser
preview-publish --health                # is the server alive?

Re-publishing under a topic that is still live updates it in place and keeps the same URL (expiry resets) — share a link once, keep refreshing the content. A topic whose preview already expired gets a brand-new URL. Add --json to any command for machine-readable output.

Library

from html_previewer import PreviewClient

c = PreviewClient("https://preview.example.com", api_key="…")
res = c.publish("./site", topic="my-site", expiry="14")   # expiry: "14" or "2m"
print(res["url"])

for p in c.list_previews():
    print(p["topic"], p["url"], p["seconds_remaining"])

c.check("my-site")          # dry-run: update in place vs new URL
c.info(res["hash"])
c.expiry(res["hash"], "extend", days=30)   # extend | expire | renew
c.delete(res["hash"])

Development

cd client
python -m pip install -e .[test]
python -m pytest tests -v

The test suite includes an end-to-end test that boots the real server from the repository checkout; it is skipped automatically when the server sources are absent (e.g. in the sdist).

License

MIT — see LICENSE.

Metadata

Release files for html-previewer 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for html-previewer 0.2.0
File Size Uploaded Provenance Actions
html_previewer-0.2.0.tar.gz 17.0 kB With provenance Details for html_previewer-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for html-previewer 0.2.0
File Interpreter ABI Platform Actions
html_previewer-0.2.0-py3-none-any.whl Python 3 none any Details for html_previewer-0.2.0-py3-none-any.whl

Total release size: 29.8 kB

Release files / html_previewer-0.2.0.tar.gz

Download URL html_previewer-0.2.0.tar.gz
Size 17.0 kB
Tags Source
SHA-256 checksum
How to use checksums
369f25f29e1f1a8e055099cd02dd9c2c0af8b84148593c3a740356b210af8cbb
BLAKE2b-256 checksum
How to use checksums
04658caf04877e13dbc73a8043a3b99290368fbd29fd538288fc6ad5ef248748
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.

Transparency log

Release files / html_previewer-0.2.0-py3-none-any.whl

Download URL html_previewer-0.2.0-py3-none-any.whl
Size 12.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
9507e9030129fa5386a2c3a661d3605c4d6bcb8ee0811a377125e6ec54cc5bcf
BLAKE2b-256 checksum
How to use checksums
716f94f5990c515199fadc99073d1b72db82ac1e3f28c5bb28fd937de2f23549
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.

Transparency log

Security for html-previewer 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for html_previewer-0.2.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 14, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page