Skip to main content

Cloudflarify

A Python package to easily start and manage Cloudflare Tunnels for exposing local services securely.

Features

Auto-downloads & updates the cloudflared binary
Supports Windows, Linux, and macOS
Works with Cloudflare account tunnels or TryCloudflare
Asynchronous & efficient (aiohttp based)
Automatic exponential backoff for stable connections

Installation

Install via PyPI:

pip install cloudflarify

Usage

Basic Usage (TryCloudflare)

import asyncio
from cloudflarify import start_tunnel

async def main():
    tunnel_url = await start_tunnel(app_port=5000)
    print(f"Tunnel is live at: {tunnel_url}")

asyncio.run(main())

With Cloudflare Account Tunnel

asyncio.run(start_tunnel(app_port=5000, tunnel_key="YOUR_TUNNEL_KEY"))

Using a Config File

asyncio.run(start_tunnel(config_file="path/to/config.yml"))

Running a Flask App with Cloudflare Tunnel

from flask import Flask
import asyncio
from cloudflarify import start_tunnel

port = 5000
app = Flask(__name__)

@app.route("/")
def home():
    return "Hello, Cloudflare Tunnel!"

if __name__ == "__main__":
    asyncio.run(start_tunnel(app_port=port))  # Start tunnel
    app.run(port=port)  # Start Flask app

Requirements

  • Python 3.7+
  • aiohttp, tqdm

Acknowledgement

This project was inspired by flask-cloudflared.

License

This project is MIT licensed.

Release files for cloudflarify 1.0.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 cloudflarify 1.0.0
File Size Uploaded
cloudflarify-1.0.0.tar.gz 3.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cloudflarify 1.0.0
File Interpreter ABI Platform
cloudflarify-1.0.0-py3-none-any.whl Python 3 none any Details

Total release size: 7.5 kB

Release files / cloudflarify-1.0.0.tar.gz

Download URL cloudflarify-1.0.0.tar.gz
Size 3.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ae57cb308cb69a9b599130239c16c7d695dd4347a2f746ee2d2426356ae14bd2
BLAKE2b-256 checksum
How to use checksums
916d23f939682ad58f2574a037a4c9f89c08654cf8ac3477b9fa99b458012243
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.8

Release files / cloudflarify-1.0.0-py3-none-any.whl

Download URL cloudflarify-1.0.0-py3-none-any.whl
Size 3.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3934d7eca338746fd8d928d8444683979c6d64139a121263488ff94c8d0759d8
BLAKE2b-256 checksum
How to use checksums
c19e844baa9d2541302049aa2c2f0eb8bc672729bc7fca59f1023ecde3b56d8a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.8

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

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