Skip to main content

A cross-framework Python SDK to register a /__ping__ endpoint for Flask, Django, and FastAPI apps.

Project description

🛡️ heimdall-python-sdk

PyPI version license GitHub issues GitHub stars

Keep your backend servers warm and monitored with a single line of code.

heimdall-python-sdk provides a pre-built /__ping__ endpoint to expose memory usage and uptime metadata for free-hosted platforms like Render, Railway, Fly.io, and more. Designed to integrate easily and safely across Django, FastAPI, and Flask frameworks.


🚀 Features

  • 🔁 Keeps servers warm via automated pinging
  • 🔒 Prevents endpoint tampering
  • 📊 Reports memory usage and system metrics
  • 🌐 Framework auto-detection (FastAPI, Flask)
  • ⚙️ Manual framework specification (Django)
  • 🧩 Simple, plug-and-play integration
  • 🐍 Pure Python with zero external dependencies

📦 Installation

pip install heimdall-python-sdk

🛠️ Usage

Django

Add the health check endpoint to your Django URL configuration:

from django.urls import path
from heimdall_python_sdk import register_ping

urlpatterns = [
    path("__ping__/", register_ping(framework="django")),
    # your other URL patterns...
]

FastAPI

Register the health check with your FastAPI application:

from fastapi import FastAPI
from heimdall_python_sdk import register_ping
import uvicorn

app = FastAPI()
register_ping(app)

if __name__ == "__main__":
    uvicorn.run(app, host="localhost", port=8000)

Flask

Register the health check with your Flask application:

from heimdall_python_sdk import register_ping
from flask import Flask

app = Flask(__name__)
register_ping(app)

if __name__ == "__main__":
    app.run(port=5000, debug=True)

🔒 Security

Heimdall is designed with security in mind:

  • Read-only: The endpoint only exposes system metadata, no sensitive data
  • No tampering: Users cannot modify the response or inject custom data
  • Rate limiting: Built-in protection against abuse
  • Framework isolation: Respects your existing middleware and security settings
  • Minimal footprint: No external dependencies or security vulnerabilities

📚 API Reference

register_ping(app=None, framework=None)

Registers a health check endpoint with your web application.

Parameters:

  • app (optional): The application instance (required for FastAPI and Flask)
  • framework (optional): Framework name for manual specification (required for Django)

Supported Frameworks:

  • "django" - Django web framework
  • Auto-detected: FastAPI, Flask

Returns:

  • For Django: Returns a URL pattern that can be included in urlpatterns
  • For FastAPI/Flask: Registers the endpoint directly with the app instance

🧪 Requirements

  • Python 3.7+
  • Compatible with Django 3.0+, FastAPI 0.65+, Flask 1.0+
  • No external dependencies required

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


🙏 Acknowledgments

  • Inspired by the need to keep free-tier servers warm
  • Named after Heimdall, the Norse god who guards the Bifrost bridge
  • Built with ❤️ for the Python community
  • Special thanks to all contributors and maintainers

Keep your servers vigilant with Heimdall! 🛡️

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

heimdall_python_sdk-0.1.2.tar.gz (5.2 kB view details)

Uploaded Source

Built Distribution

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

heimdall_python_sdk-0.1.2-py3-none-any.whl (6.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: heimdall_python_sdk-0.1.2.tar.gz
  • Upload date:
  • Size: 5.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.4

File hashes

Hashes for heimdall_python_sdk-0.1.2.tar.gz
Algorithm Hash digest
SHA256 59eff3914ae8f16e183e9e578773106a9170da46ffdba53da6f700a47962d489
MD5 438da3a712dd392f1ebd12acf1e24710
BLAKE2b-256 5d04ad5ab9556c47db1d2b2acbb28dd38c0ab02307dc3ff6b94fc1e6905e01ca

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for heimdall_python_sdk-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 1d776be9bc8b439345a3366dddb45a7777fe2e01b4a9cdcb43e929aed5799b78
MD5 95a6be14021911182ef888edeb48184d
BLAKE2b-256 c2b55eb66af80027593aa1dbd2253fcf929c1a8826fd61a0e2bd673bcaaeb018

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