A Python CLI tool for effortless Cloudflare Tunnel management
Project description
Pyflared wraps the official cloudflared binary and the Cloudflare API to provide a seamless CLI experience for
creating and managing Cloudflare Tunnels. No more manual token juggling or complex configurations—just simple commands
to expose your local services to the internet.
✨ Features
- 🚀 Quick Tunnels — Spin up instant, temporary public URLs for local services with a single command
- 🔗 DNS-Mapped Tunnels — Create persistent tunnels with automatic DNS record management
- 🧹 Automatic Cleanup — Orphan tunnel and stale DNS record detection & removal
- 📦 Batteries Included — Bundles the
cloudflaredbinary, no separate installation required - 🐳 Docker Ready — Run as a container with minimal setup
- 🔐 Secure by Design — API tokens are never logged or exposed; uses Pydantic's
SecretStr
📦 Installation
Using uv (Recommended)
uv tool install pyflared
Using pip
pip install pyflared
Using Docker
docker pull ghcr.io/azmainmahatab/pyflared:latest
docker run --rm ghcr.io/azmainmahatab/pyflared --help
🚀 Quick Start
Create a Quick Tunnel
Expose a local service instantly with a temporary trycloudflare.com URL:
pyflared tunnel quick 8000
This creates a public URL (e.g., https://random-name.trycloudflare.com) pointing to localhost:8000.
Create a DNS-Mapped Tunnel
Create a persistent tunnel with your own domain:
pyflared tunnel mapped api.example.com=localhost:8000 web.example.com=localhost:3000
This will:
- Create a new Cloudflare Tunnel
- Configure DNS records for your domains
- Route traffic to your local services
Note: Requires a Cloudflare API token with tunnel and DNS permissions. Set via
CLOUDFLARE_API_TOKENenvironment variable or enter when prompted.
Cleanup Orphan Tunnels
Remove stale tunnels and DNS records created by pyflared:
pyflared tunnel cleanup
📖 Usage
pyflared --help
Commands
| Command | Description |
|---|---|
pyflared version |
Show the bundled cloudflared version |
pyflared tunnel quick <service> |
Create a quick tunnel to a local service |
pyflared tunnel mapped <pairs...> |
Create DNS-mapped tunnel(s) |
pyflared tunnel cleanup |
Remove orphan tunnels and DNS records |
Options for tunnel mapped
| Option | Description |
|---|---|
--keep-orphans, -k |
Preserve orphan tunnels (prevents default removal) |
--tunnel-name, -n |
Specify a custom tunnel name (default: hostname_YYYY-MM-DD_...) |
--verbose, -v |
Show detailed cloudflared logs |
🔧 Configuration
Environment Variables
| Variable | Description |
|---|---|
CLOUDFLARE_API_TOKEN |
Your Cloudflare API token for tunnel management |
API Token Permissions
For DNS-mapped tunnels, your API token needs the following permissions:
- Account > Cloudflare Tunnel > Edit
- Zone > DNS > Edit
- Zone > Zone > Read
🛠️ Development
Prerequisites
- Python 3.12+
- Hatch
Setup
git clone https://github.com/AzmainMahatab/pyflared.git
cd pyflared
hatch env create
Running Tests
hatch test
Type Checking
hatch run types:check
Building
hatch build
📄 License
Pyflared is distributed under the terms of the MIT license.
🙏 Acknowledgments
- cloudflared — The official Cloudflare Tunnel client
- Typer — CLI framework
Made with ❤️ by Azmain Mahatab
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 Distributions
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 pyflared-0.0.1b7.tar.gz.
File metadata
- Download URL: pyflared-0.0.1b7.tar.gz
- Upload date:
- Size: 30.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5c1440e09a30d9395e0d9972e1d9b61f770d9f0ae0335b17b10c289aea0aed8
|
|
| MD5 |
a95ffec3a359e5ce1674771ea5437994
|
|
| BLAKE2b-256 |
f2f24fe3bd5cffb978ece18a47719508ccdc86c58858144a9d476c3715a497e0
|
Provenance
The following attestation bundles were made for pyflared-0.0.1b7.tar.gz:
Publisher:
cd.yml on AzmainMahatab/pyflared
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyflared-0.0.1b7.tar.gz -
Subject digest:
d5c1440e09a30d9395e0d9972e1d9b61f770d9f0ae0335b17b10c289aea0aed8 - Sigstore transparency entry: 833833946
- Sigstore integration time:
-
Permalink:
AzmainMahatab/pyflared@6550ab9adce88b1a948484abb8ce7978397669d8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/AzmainMahatab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@6550ab9adce88b1a948484abb8ce7978397669d8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyflared-0.0.1b7-py3-none-win_amd64.whl.
File metadata
- Download URL: pyflared-0.0.1b7-py3-none-win_amd64.whl
- Upload date:
- Size: 18.8 MB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
15ec00bfb338faecfbe4eda19e52949081a8a109d74002dbad3f6378ba6409ac
|
|
| MD5 |
87b730be9b17f9fee642ac77b451fd89
|
|
| BLAKE2b-256 |
88f7fd09b552c6347ff9f9a7e84743414b414f5e7a42ec2a0d581236e50392e1
|
Provenance
The following attestation bundles were made for pyflared-0.0.1b7-py3-none-win_amd64.whl:
Publisher:
cd.yml on AzmainMahatab/pyflared
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyflared-0.0.1b7-py3-none-win_amd64.whl -
Subject digest:
15ec00bfb338faecfbe4eda19e52949081a8a109d74002dbad3f6378ba6409ac - Sigstore transparency entry: 833833955
- Sigstore integration time:
-
Permalink:
AzmainMahatab/pyflared@6550ab9adce88b1a948484abb8ce7978397669d8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/AzmainMahatab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@6550ab9adce88b1a948484abb8ce7978397669d8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyflared-0.0.1b7-py3-none-musllinux_1_1_x86_64.whl.
File metadata
- Download URL: pyflared-0.0.1b7-py3-none-musllinux_1_1_x86_64.whl
- Upload date:
- Size: 20.2 MB
- Tags: Python 3, musllinux: musl 1.1+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
146cb0614567e7095753e8e05646f8422e767f895a465cf7070cd2e08b455ad4
|
|
| MD5 |
8bcd8bd17ed154b7dc71ec98484c14be
|
|
| BLAKE2b-256 |
0bd4b6fe11b0b8df9f3ed7effedb791e37322e13c04f25c5be72c7cad0e96189
|
Provenance
The following attestation bundles were made for pyflared-0.0.1b7-py3-none-musllinux_1_1_x86_64.whl:
Publisher:
cd.yml on AzmainMahatab/pyflared
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyflared-0.0.1b7-py3-none-musllinux_1_1_x86_64.whl -
Subject digest:
146cb0614567e7095753e8e05646f8422e767f895a465cf7070cd2e08b455ad4 - Sigstore transparency entry: 833833948
- Sigstore integration time:
-
Permalink:
AzmainMahatab/pyflared@6550ab9adce88b1a948484abb8ce7978397669d8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/AzmainMahatab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@6550ab9adce88b1a948484abb8ce7978397669d8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyflared-0.0.1b7-py3-none-musllinux_1_1_aarch64.whl.
File metadata
- Download URL: pyflared-0.0.1b7-py3-none-musllinux_1_1_aarch64.whl
- Upload date:
- Size: 18.9 MB
- Tags: Python 3, musllinux: musl 1.1+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c73286d120a6fd6ba29742401f7567230fd2b51dde11a8f450707f07bcf304e5
|
|
| MD5 |
4e5bf135ed2aecb27127e2122def13d8
|
|
| BLAKE2b-256 |
1dc43584b116feab6f6a88316d7111c7d882e0f08dd925d2a95c931f5eca969a
|
Provenance
The following attestation bundles were made for pyflared-0.0.1b7-py3-none-musllinux_1_1_aarch64.whl:
Publisher:
cd.yml on AzmainMahatab/pyflared
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyflared-0.0.1b7-py3-none-musllinux_1_1_aarch64.whl -
Subject digest:
c73286d120a6fd6ba29742401f7567230fd2b51dde11a8f450707f07bcf304e5 - Sigstore transparency entry: 833833953
- Sigstore integration time:
-
Permalink:
AzmainMahatab/pyflared@6550ab9adce88b1a948484abb8ce7978397669d8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/AzmainMahatab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@6550ab9adce88b1a948484abb8ce7978397669d8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyflared-0.0.1b7-py3-none-manylinux_2_17_x86_64.whl.
File metadata
- Download URL: pyflared-0.0.1b7-py3-none-manylinux_2_17_x86_64.whl
- Upload date:
- Size: 20.2 MB
- Tags: Python 3, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9115b0ce38af4bf8903c9215fc754e901f5ea5011efd3563f9e8bcdbc0a98dc3
|
|
| MD5 |
cd6f10012001f3b63f7c6809170ae840
|
|
| BLAKE2b-256 |
1c83199dc4b2dfde71460f66945f2cc6cc6b5a6d196980862580cbe65213ea65
|
Provenance
The following attestation bundles were made for pyflared-0.0.1b7-py3-none-manylinux_2_17_x86_64.whl:
Publisher:
cd.yml on AzmainMahatab/pyflared
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyflared-0.0.1b7-py3-none-manylinux_2_17_x86_64.whl -
Subject digest:
9115b0ce38af4bf8903c9215fc754e901f5ea5011efd3563f9e8bcdbc0a98dc3 - Sigstore transparency entry: 833833947
- Sigstore integration time:
-
Permalink:
AzmainMahatab/pyflared@6550ab9adce88b1a948484abb8ce7978397669d8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/AzmainMahatab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@6550ab9adce88b1a948484abb8ce7978397669d8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyflared-0.0.1b7-py3-none-manylinux_2_17_aarch64.whl.
File metadata
- Download URL: pyflared-0.0.1b7-py3-none-manylinux_2_17_aarch64.whl
- Upload date:
- Size: 18.9 MB
- Tags: Python 3, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2d43b3ada3abd46b3e8ec0d8ee2a4e9bf1e889bc20c64aaaa839af8903391d74
|
|
| MD5 |
6defa0badbd93a8096cfb97588cc943a
|
|
| BLAKE2b-256 |
f018cc55c282e4107ceb15e3a0bc77995f38d748178920de99145bffc0c1c137
|
Provenance
The following attestation bundles were made for pyflared-0.0.1b7-py3-none-manylinux_2_17_aarch64.whl:
Publisher:
cd.yml on AzmainMahatab/pyflared
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyflared-0.0.1b7-py3-none-manylinux_2_17_aarch64.whl -
Subject digest:
2d43b3ada3abd46b3e8ec0d8ee2a4e9bf1e889bc20c64aaaa839af8903391d74 - Sigstore transparency entry: 833833952
- Sigstore integration time:
-
Permalink:
AzmainMahatab/pyflared@6550ab9adce88b1a948484abb8ce7978397669d8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/AzmainMahatab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@6550ab9adce88b1a948484abb8ce7978397669d8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyflared-0.0.1b7-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: pyflared-0.0.1b7-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 19.4 MB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
34a2a4552e83c59c01bc7ded9be9a85c1aad8d5599a55c31150ffb7a29919884
|
|
| MD5 |
15cb82d5a098c77b82787f53050b9ded
|
|
| BLAKE2b-256 |
27923d1d876b5655dee4a4936ed0017fe30d72c0739dbba61333a847dbd36050
|
Provenance
The following attestation bundles were made for pyflared-0.0.1b7-py3-none-macosx_11_0_arm64.whl:
Publisher:
cd.yml on AzmainMahatab/pyflared
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyflared-0.0.1b7-py3-none-macosx_11_0_arm64.whl -
Subject digest:
34a2a4552e83c59c01bc7ded9be9a85c1aad8d5599a55c31150ffb7a29919884 - Sigstore transparency entry: 833833950
- Sigstore integration time:
-
Permalink:
AzmainMahatab/pyflared@6550ab9adce88b1a948484abb8ce7978397669d8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/AzmainMahatab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@6550ab9adce88b1a948484abb8ce7978397669d8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyflared-0.0.1b7-py3-none-macosx_10_9_x86_64.whl.
File metadata
- Download URL: pyflared-0.0.1b7-py3-none-macosx_10_9_x86_64.whl
- Upload date:
- Size: 21.1 MB
- Tags: Python 3, macOS 10.9+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a2eaebd6b06ed6a2e54a08f2b1c4757f85a380e21b83eca07012d6839a0e6c16
|
|
| MD5 |
343572c69e2f2cf646328439c11b8ea4
|
|
| BLAKE2b-256 |
deea8f993f067ce96cf269461d77fdb346cb3cf5fb8a4713d9e484ad9246602f
|
Provenance
The following attestation bundles were made for pyflared-0.0.1b7-py3-none-macosx_10_9_x86_64.whl:
Publisher:
cd.yml on AzmainMahatab/pyflared
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyflared-0.0.1b7-py3-none-macosx_10_9_x86_64.whl -
Subject digest:
a2eaebd6b06ed6a2e54a08f2b1c4757f85a380e21b83eca07012d6839a0e6c16 - Sigstore transparency entry: 833833951
- Sigstore integration time:
-
Permalink:
AzmainMahatab/pyflared@6550ab9adce88b1a948484abb8ce7978397669d8 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/AzmainMahatab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
cd.yml@6550ab9adce88b1a948484abb8ce7978397669d8 -
Trigger Event:
push
-
Statement type: