A cross-framework Python SDK to register a /__ping__ endpoint for Flask, Django, and FastAPI apps.
Project description
🛡️ heimdall-python-sdk
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
app = FastAPI()
register_ping(app) # Auto-detects FastAPI
# Your FastAPI routes and logic here...
Flask
Register the health check with your Flask application:
from flask import Flask
from heimdall_python_sdk import register_ping
app = Flask(__name__)
register_ping(app) # Auto-detects Flask
# Your Flask routes and logic here...
if __name__ == "__main__":
app.run()
🔒 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.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file heimdall_python_sdk-0.1.1.tar.gz.
File metadata
- Download URL: heimdall_python_sdk-0.1.1.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ed37b7ca7952a5ada4616ad4791356794f73f041b693f9a3b15bac813d9f982
|
|
| MD5 |
b9c659ff6cfd54de1526e29ccd1b4935
|
|
| BLAKE2b-256 |
2fc8a3f0c6e093fa0b4226fea6b336c2bbef551a5f234652eb03669bcb683b46
|
File details
Details for the file heimdall_python_sdk-0.1.1-py3-none-any.whl.
File metadata
- Download URL: heimdall_python_sdk-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2b210eb7c54d028a6094ab1c4794e6f31a056df2b1a7b667d74db57677958d81
|
|
| MD5 |
cc9afd949d5f95eb2241117d4459b0fb
|
|
| BLAKE2b-256 |
bc1f5bd2ab52dbb677f32a1fe4f19dcb9e04fbeb4fc85b20be9fd238bb835ae4
|