Skip to main content

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"
})

Health Check

A /health endpoint is always available alongside your custom / response, returning {"status": "ok"}. Useful for platforms that want a dedicated health-check path separate from your custom response.


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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

staypresent-1.0.4.tar.gz (4.6 kB view details)

Uploaded Source

Built Distribution

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

staypresent-1.0.4-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file staypresent-1.0.4.tar.gz.

File metadata

  • Download URL: staypresent-1.0.4.tar.gz
  • Upload date:
  • Size: 4.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for staypresent-1.0.4.tar.gz
Algorithm Hash digest
SHA256 1725a32d47ca575b6422568e642cd229429b07043e6451341b4434748bd8b7ca
MD5 c180b4c4f7a3d18e1efdc71babea3257
BLAKE2b-256 12004520e958aabf7d4a005ed3da3253ec5a913d21deffa2e7b9a25c8e803955

See more details on using hashes here.

Provenance

The following attestation bundles were made for staypresent-1.0.4.tar.gz:

Publisher: python-publish.yml on NTDevLops/StayPresent

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file staypresent-1.0.4-py3-none-any.whl.

File metadata

  • Download URL: staypresent-1.0.4-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for staypresent-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 79fd48a1a0a401e3dcf72a620c385f738dabad8a1ee2eb4344d10fd1155e5c3f
MD5 993a1872e667fdfef5d003668154f9ce
BLAKE2b-256 4a72a0857f499446b67184849d83425e826528fbca5d03e7fe0fd73ce466ede9

See more details on using hashes here.

Provenance

The following attestation bundles were made for staypresent-1.0.4-py3-none-any.whl:

Publisher: python-publish.yml on NTDevLops/StayPresent

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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