Skip to main content

Edge/IoT adaptive reverse proxy with policy routing, caching, and offline-aware fallback.

Project description

edge-proxy-py

PyPI Python Versions License GitHub stars Downloads

edge-proxy-py is a lightweight reverse proxy designed for edge / IoT deployments.

Focus:

  • offline/unstable network conditions
  • routing policies (geo/device/priority)
  • local cache fallback
  • health checks and telemetry

Features

  • Reverse proxy gateway for edge services
  • Policy-based routing (device-id header / path rules)
  • Concurrent backend health checking with connection pooling
  • In-memory cache fallback for GET requests (TTL-based with LRU-like eviction)
  • Prometheus metrics (request count, cache hits/misses, backend health)
  • Graceful shutdown (SIGINT/SIGTERM)

Quickstart

Install

pip install edge-proxy-py

Run

edge-proxy run -c examples/config.yml

Test

curl -H "X-Device-ID: sensor-1" http://localhost:9100/api/data

Architecture

Client ──► edge-proxy ──► Route matching (path_prefix / device_id)
                              │
                         ┌────▼────┐
                         │  Cache  │──► Return cached response (GET only)
                         └────┬────┘
                              │ miss
                         ┌────▼────┐
                         │ Backend │──► forward() via httpx connection pool
                         └────┬────┘
                              ▼
                       Upstream server

Changelog

0.1.1

  • Connection pooling: Shared httpx.AsyncClient singleton for proxy and healthcheck (was creating a client per request/check).
  • Concurrent health checks: Backends checked in parallel via asyncio.gather (was sequential).
  • Graceful shutdown: Signal handlers (SIGINT/SIGTERM) cancel healthcheck loop and close clients cleanly.
  • Logging: Added structured logging throughout; --log-level CLI option.
  • Bare except fixes: All except Exception blocks re-raise asyncio.CancelledError.
  • Build system: Migrated from setuptools to hatchling. Added classifiers, keywords, optional dev/test deps, ruff/pytest config.
  • Tests: Expanded from 1 test to 15+ tests covering config, router, cache, proxy, healthcheck, and backends.
  • CI: Added GitHub Actions workflow (ruff + pytest on 3.10–3.12).

0.1.0

  • Initial release: Reverse proxy, policy-based routing, cache fallback, health checks, Prometheus metrics.

License

MIT

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

edge_proxy_py-0.1.2.tar.gz (9.2 kB view details)

Uploaded Source

Built Distribution

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

edge_proxy_py-0.1.2-py3-none-any.whl (10.8 kB view details)

Uploaded Python 3

File details

Details for the file edge_proxy_py-0.1.2.tar.gz.

File metadata

  • Download URL: edge_proxy_py-0.1.2.tar.gz
  • Upload date:
  • Size: 9.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for edge_proxy_py-0.1.2.tar.gz
Algorithm Hash digest
SHA256 a82005847046a774da0dbd2e6cab08c76ffadf0d1a7a7185dcc6b4433694dd2c
MD5 80ca8fcfc464a527ea430ab484bc4b39
BLAKE2b-256 3191cf5fc4d71dd5a0c988355b10b70481f8430e86c9cb688dd195a7a465b142

See more details on using hashes here.

File details

Details for the file edge_proxy_py-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: edge_proxy_py-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 10.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for edge_proxy_py-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2fc9698b8fd7f3335f9207d06ec018a916e31035815c578351a1d8e7cc9b4057
MD5 cf8aad2bc8f089449df33308776fc634
BLAKE2b-256 154559e67fddf322aa31d59f91eba2f27050c80930fff78cf09f4ba9d2400d0a

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