Skip to main content

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

Project description

Heimdall Logo

Heimdall

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(file: urls.py) configuration:

from django.urls import path
from heimdall_python_sdk import register_ping, heimdall_ping_point

urlpatterns = [
    path(heimdall_ping_point, 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.3.tar.gz (5.4 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.3-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: heimdall_python_sdk-0.1.3.tar.gz
  • Upload date:
  • Size: 5.4 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.3.tar.gz
Algorithm Hash digest
SHA256 89d4e2b8d628da4f729ea27c55c522dc203b20c634924ed975554d0f73e9ba59
MD5 37bf066845ad504f9fc837cf7539b7ad
BLAKE2b-256 1fbb516f8a77bc085f26ca2bfbaf726e9ed525a1dbc5379bacf4b0f3f834b512

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for heimdall_python_sdk-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 69473f9970b6f1f9a3b4d69272c63b73bf7f8199d5fa4efb1e60ad56a8970e41
MD5 845cb7eb87052df0236ebbf259dc9b9e
BLAKE2b-256 f058b1f7b24c5ead142e77d19d1c858252027243d942770cdd66b430c212f590

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