TelePress
TelePress publishes Markdown, plain text, images, and ZIP galleries to Telegraph. It supports automatic pagination, external image hosts, image compression, concurrent uploads, and an optional REST API.
Requirements
- Python 3.10 or newer
- A Telegraph token, or permission to create one on first use
- An image-host configuration only when publishing images or galleries
Installation
pip install telepress
# Optional REST API
pip install "telepress[api]"
# Optional S3-compatible hosts such as AWS S3 and Cloudflare R2
pip install "telepress[s3]"
# Optional YAML configuration files
pip install "telepress[yaml]"
Install from source for development:
git clone https://github.com/redtidev1918/telepress.git
cd telepress
python -m pip install --editable ".[dev]"
Quick start
Publish a document:
telepress article.md --title "My post"
# The explicit subcommand is equivalent
telepress publish article.md --title "My post"
Publish an image or ZIP gallery after configuring an image host:
telepress configure
telepress check
telepress photo.jpg --title "Photo"
telepress gallery.zip --title "Gallery"
Useful publishing options:
# Override the configured image limit in MiB
telepress gallery.zip --image-size-limit 10
# Keep original images instead of compressing oversized files
telepress gallery.zip --no-compress
# Use a Telegraph-compatible API endpoint
telepress article.md --api-url http://localhost:9009
Text-only publishing does not load or require an image-host configuration.
The Telegraph access token is created automatically when needed and stored in
~/.telegraph_token unless one is supplied with --token.
REST API
Install the optional API dependencies first: pip install "telepress[api]".
telepress-server --host 127.0.0.1 --port 8000
Interactive OpenAPI documentation is available at
http://127.0.0.1:8000/docs.
curl -X POST http://127.0.0.1:8000/publish/text \
-H "Content-Type: application/json" \
-d '{"content":"# Title\n\nBody","title":"Example"}'
curl -X POST http://127.0.0.1:8000/publish/file \
-F "file=@article.md" \
-F "title=Example"
curl -X POST http://127.0.0.1:8000/publish/gallery \
-F "files=@p0.jpg" \
-F "files=@p1.jpg" \
-F "title=Gallery title" \
-F "tags=pixiv, illustration" \
-F "link=https://www.pixiv.net/artworks/123456" \
-F "spoiler=true"
/publish/gallery accepts repeated files parts plus optional title,
tags (comma-separated), link (source URL) and spoiler (truthy for R-18
content) form fields. Files are packed into a zip in upload order and
published with automatic pagination and Prev/Next navigation; tags, link
and the R-18 warning are rendered as a footer on the first page. It returns
{"ok": true, "url": "...", "files": N} and is compatible with generic
multipart delivery clients, e.g. PixivFlow httpMultipart targets pointing
at http://<telepress-host>:8000/publish/gallery.
Blocking file, compression, and network work is dispatched away from the API event loop, so concurrent requests do not serialize on those operations.
Image hosts
Supported hosts:
- ImgBB
- Imgur
- sm.ms
- S3-compatible storage, including AWS S3, Cloudflare R2, OSS, and MinIO
- Rclone remotes
- Custom HTTP upload APIs
Run telepress configure for the interactive setup, or create
~/.telepress.json:
{
"image_host": {
"type": "rclone",
"remote_path": "myremote:bucket/path",
"public_url": "https://cdn.example.com/path",
"rclone_flags": ["--transfers=32", "--checkers=32"],
"max_size_mb": 20,
"max_workers": 8
}
}
S3-compatible configuration:
{
"image_host": {
"type": "s3",
"access_key_id": "your-access-key",
"secret_access_key": "your-secret-key",
"bucket": "your-bucket",
"public_url": "https://cdn.example.com",
"endpoint_url": "https://s3.example.com",
"region_name": "auto"
}
}
Environment variables override file configuration:
export TELEPRESS_IMAGE_HOST_TYPE=imgbb
export TELEPRESS_IMAGE_HOST_API_KEY=your-key
Configuration is searched in the following locations:
- The path passed to
load_config() TELEPRESS_CONFIG~/.telepress.json,~/.telepress.yaml,~/.telepress.yml~/.config/telepress.json
Python API
from telepress import TelegraphPublisher, publish, publish_text
url = publish("article.md", title="My article")
text_url = publish_text("# Hello\n\nWorld", title="Hello")
publisher = TelegraphPublisher(image_size_limit=10)
gallery_url = publisher.publish("gallery.zip", title="Gallery")
Upload images directly:
from telepress import ImageUploader
uploader = ImageUploader("imgbb", api_key="your-key")
url = uploader.upload("photo.jpg")
batch = uploader.upload_batch(["1.jpg", "2.jpg"])
print(batch.success_rate, batch.get_url_map())
Behavior and limits
- Markdown and plain text are converted to Telegraph DOM nodes.
- Plain text chapter headings such as
Chapter 1and第一章are detected. - Large text is split near 10,000-character boundaries and linked with previous/next navigation.
- Galleries are split at 100 images per page.
- Images larger than 5 MiB are compressed by default; GIF compression is intentionally skipped.
- A 2 GiB input safety limit is applied before processing.
- Duplicate text publications are cached in
~/.telepress_cache.jsonby default.
Supported input extensions include .txt, .md, .markdown, .rst,
.text, .jpg, .jpeg, .png, .gif, .webp, .bmp, and .zip.
Error handling
from telepress import TelePressError, ValidationError, publish
try:
url = publish("article.md")
except ValidationError as exc:
print(f"Invalid input: {exc}")
except TelePressError as exc:
print(f"Publishing failed: {exc}")
Development and releases
python -m pip install --editable ".[dev]"
python -m pytest --cov
python -m build
python -m twine check dist/*
See CONTRIBUTING.md for contribution conventions and docs/RELEASING.md for the automated release workflow. Notable changes are recorded in CHANGELOG.md.
License
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 telepress-0.5.0.tar.gz.
File metadata
- Download URL: telepress-0.5.0.tar.gz
- Upload date:
- Size: 69.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4a2f1d14e38c48577af199362fe00154593ac6f492da5aa550b37bc05e01b523
|
|
| MD5 |
162d4ecb49e3f6ce2338d287226aa605
|
|
| BLAKE2b-256 |
5f6c8887799156f7cbd0bfdfd3a0e815e805e901dad6e053632a555ae2601339
|
Provenance
The following attestation bundles were made for telepress-0.5.0.tar.gz:
Publisher:
release.yml on redtidev1918/telepress
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
telepress-0.5.0.tar.gz -
Subject digest:
4a2f1d14e38c48577af199362fe00154593ac6f492da5aa550b37bc05e01b523 - Sigstore transparency entry: 2651318207
- Sigstore integration time:
-
Permalink:
redtidev1918/telepress@6d166c292d1902bdf44592728dd38ba95574a8a7 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/redtidev1918
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6d166c292d1902bdf44592728dd38ba95574a8a7 -
Trigger Event:
push
-
Statement type:
File details
Details for the file telepress-0.5.0-py3-none-any.whl.
File metadata
- Download URL: telepress-0.5.0-py3-none-any.whl
- Upload date:
- Size: 37.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via:
twine/7.0.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fbac283ec36a6050041eb5c012c641386daa8bfd66dffb5cf50385b04874b202
|
|
| MD5 |
1f7ad4ba6db4904aff2ca25ba9a0bbd0
|
|
| BLAKE2b-256 |
47e6c246e4797cc0b43ed321a6e5599b88b63bbbf24640058976805c8c9d17b6
|
Provenance
The following attestation bundles were made for telepress-0.5.0-py3-none-any.whl:
Publisher:
release.yml on redtidev1918/telepress
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
telepress-0.5.0-py3-none-any.whl -
Subject digest:
fbac283ec36a6050041eb5c012c641386daa8bfd66dffb5cf50385b04874b202 - Sigstore transparency entry: 2651318236
- Sigstore integration time:
-
Permalink:
redtidev1918/telepress@6d166c292d1902bdf44592728dd38ba95574a8a7 -
Branch / Tag:
refs/heads/master - Owner: https://github.com/redtidev1918
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@6d166c292d1902bdf44592728dd38ba95574a8a7 -
Trigger Event:
push
-
Statement type: