Run your Python bot alongside a lightweight Flask web server.
Project description
StayPresent
A lightweight Python package that keeps your bot or script alive by running a small Flask web server alongside your application.
Perfect for platforms like Render, Railway, Koyeb, Heroku, or anywhere an HTTP server is required to keep your service active.
Features
- 🚀 One-line setup
- 🌐 Built-in Flask web server
- 🤖 Runs your Python bot/script automatically
- 📄 Custom text response
- 📦 JSON response support
- ⚡ Lightweight and easy to use
Installation
pip install staypresent
Or install locally:
pip install .
Basic Usage
import staypresent
staypresent.web.text("Made With ❤️")
staypresent.run("bot.py")
Open your browser:
http://localhost:8080
Response:
Made With ❤️
JSON Response
import staypresent
staypresent.web.json({
"status": "online",
"developer": "John",
"message": "Made With Love ❤️"
})
staypresent.run("bot.py")
Response
{
"status": "online",
"developer": "John",
"message": "Made With Love ❤️"
}
Custom Port
import staypresent
staypresent.run(
"bot.py",
port=5000
)
Custom Host
staypresent.run(
"bot.py",
host="0.0.0.0"
)
Complete Example
import staypresent
staypresent.web.json({
"status": "Running",
"version": "1.0.0",
"message": "Made With Love ❤️"
})
staypresent.run(
"body.py",
host="0.0.0.0",
port=8080
)
API
Run your bot
staypresent.run(
bot_file,
host="0.0.0.0",
port=8080
)
| Parameter | Type | Description |
|---|---|---|
bot_file |
str | Path to your Python script |
host |
str | Flask host |
port |
int | Flask port |
Plain Text Response
staypresent.web.text("Hello World")
JSON Response
staypresent.web.json({
"hello": "world"
})
Requirements
- Python 3.8+
- Flask
Use Cases
- Telegram Bots
- Discord Bots
- Automation Scripts
- Background Workers
- Render Deployments
- Railway Deployments
- Koyeb Deployments
- Heroku Apps
License
MIT License
Made with ❤️ using Python.
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 staypresent-1.0.0.tar.gz.
File metadata
- Download URL: staypresent-1.0.0.tar.gz
- Upload date:
- Size: 4.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fe128c2365a081500e000f630abae85e0d782fb5f7ec569b5f5310b6aa608e37
|
|
| MD5 |
fa4f573ce0d8fe175d505daf99bdf591
|
|
| BLAKE2b-256 |
08cdf891329cea4eb5efe6e37cbbc4c05b5f25389873aede5b97ae3241a08f9e
|
File details
Details for the file staypresent-1.0.0-py3-none-any.whl.
File metadata
- Download URL: staypresent-1.0.0-py3-none-any.whl
- Upload date:
- Size: 4.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
969b19068fd8fba9f2466a6b0c9b806b930b6d247807ea290fb409fb65d1e84d
|
|
| MD5 |
dfce9db44686b02588bedd848f9a3bd9
|
|
| BLAKE2b-256 |
fee3bb5868316b7f1118e57ddfe06b0c442714940322d4b806c11f8324c4bfca
|