Skip to main content

A Python wrapper to run Cloudflare tunnels programmatically

Project description

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.

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

cloudflarify-1.0.0.tar.gz (3.6 kB view details)

Uploaded Source

Built Distribution

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

cloudflarify-1.0.0-py3-none-any.whl (3.9 kB view details)

Uploaded Python 3

File details

Details for the file cloudflarify-1.0.0.tar.gz.

File metadata

  • Download URL: cloudflarify-1.0.0.tar.gz
  • Upload date:
  • Size: 3.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for cloudflarify-1.0.0.tar.gz
Algorithm Hash digest
SHA256 ae57cb308cb69a9b599130239c16c7d695dd4347a2f746ee2d2426356ae14bd2
MD5 93f5adea8d24d68b14e9f62b9a78402e
BLAKE2b-256 916d23f939682ad58f2574a037a4c9f89c08654cf8ac3477b9fa99b458012243

See more details on using hashes here.

File details

Details for the file cloudflarify-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: cloudflarify-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 3.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for cloudflarify-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3934d7eca338746fd8d928d8444683979c6d64139a121263488ff94c8d0759d8
MD5 8bd79269af13b4d92498312f425d7c79
BLAKE2b-256 c19e844baa9d2541302049aa2c2f0eb8bc672729bc7fca59f1023ecde3b56d8a

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