staypresent 1.0.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- staypresent-1.0.0/LICENSE +21 -0
- staypresent-1.0.0/PKG-INFO +211 -0
- staypresent-1.0.0/README.md +192 -0
- staypresent-1.0.0/pyproject.toml +38 -0
- staypresent-1.0.0/setup.cfg +4 -0
- staypresent-1.0.0/staypresent/__init__.py +4 -0
- staypresent-1.0.0/staypresent/runner.py +43 -0
- staypresent-1.0.0/staypresent/server.py +14 -0
- staypresent-1.0.0/staypresent/web.py +12 -0
- staypresent-1.0.0/staypresent.egg-info/PKG-INFO +211 -0
- staypresent-1.0.0/staypresent.egg-info/SOURCES.txt +12 -0
- staypresent-1.0.0/staypresent.egg-info/dependency_links.txt +1 -0
- staypresent-1.0.0/staypresent.egg-info/requires.txt +1 -0
- staypresent-1.0.0/staypresent.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 NTDevLops
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: staypresent
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Run your Python bot alongside a lightweight Flask web server.
|
|
5
|
+
Author: Ashish Sharma
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/NTDevLops/staypresent
|
|
8
|
+
Project-URL: Repository, https://github.com/NTDevLops/staypresent
|
|
9
|
+
Project-URL: Issues, https://github.com/NTDevLops/staypresent/issues
|
|
10
|
+
Keywords: flask,telegram,discord,bot,webserver,keepalive
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Requires-Python: >=3.8
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Requires-Dist: Flask>=3.0.0
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# StayPresent
|
|
21
|
+
|
|
22
|
+
A lightweight Python package that keeps your bot or script alive by running a small Flask web server alongside your application.
|
|
23
|
+
|
|
24
|
+
Perfect for platforms like **Render**, **Railway**, **Koyeb**, **Heroku**, or anywhere an HTTP server is required to keep your service active.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Features
|
|
29
|
+
|
|
30
|
+
- 🚀 One-line setup
|
|
31
|
+
- 🌐 Built-in Flask web server
|
|
32
|
+
- 🤖 Runs your Python bot/script automatically
|
|
33
|
+
- 📄 Custom text response
|
|
34
|
+
- 📦 JSON response support
|
|
35
|
+
- ⚡ Lightweight and easy to use
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Installation
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install staypresent
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Or install locally:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pip install .
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Basic Usage
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
import staypresent
|
|
57
|
+
|
|
58
|
+
staypresent.web.text("Made With ❤️")
|
|
59
|
+
|
|
60
|
+
staypresent.run("bot.py")
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Open your browser:
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
http://localhost:8080
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Response:
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
Made With ❤️
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## JSON Response
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
import staypresent
|
|
81
|
+
|
|
82
|
+
staypresent.web.json({
|
|
83
|
+
"status": "online",
|
|
84
|
+
"developer": "John",
|
|
85
|
+
"message": "Made With Love ❤️"
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
staypresent.run("bot.py")
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Response
|
|
92
|
+
|
|
93
|
+
```json
|
|
94
|
+
{
|
|
95
|
+
"status": "online",
|
|
96
|
+
"developer": "John",
|
|
97
|
+
"message": "Made With Love ❤️"
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Custom Port
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
import staypresent
|
|
107
|
+
|
|
108
|
+
staypresent.run(
|
|
109
|
+
"bot.py",
|
|
110
|
+
port=5000
|
|
111
|
+
)
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Custom Host
|
|
117
|
+
|
|
118
|
+
```python
|
|
119
|
+
staypresent.run(
|
|
120
|
+
"bot.py",
|
|
121
|
+
host="0.0.0.0"
|
|
122
|
+
)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Complete Example
|
|
128
|
+
|
|
129
|
+
```python
|
|
130
|
+
import staypresent
|
|
131
|
+
|
|
132
|
+
staypresent.web.json({
|
|
133
|
+
"status": "Running",
|
|
134
|
+
"version": "1.0.0",
|
|
135
|
+
"message": "Made With Love ❤️"
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
staypresent.run(
|
|
139
|
+
"body.py",
|
|
140
|
+
host="0.0.0.0",
|
|
141
|
+
port=8080
|
|
142
|
+
)
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## API
|
|
148
|
+
|
|
149
|
+
### Run your bot
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
staypresent.run(
|
|
153
|
+
bot_file,
|
|
154
|
+
host="0.0.0.0",
|
|
155
|
+
port=8080
|
|
156
|
+
)
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
| Parameter | Type | Description |
|
|
160
|
+
|-----------|------|-------------|
|
|
161
|
+
| `bot_file` | str | Path to your Python script |
|
|
162
|
+
| `host` | str | Flask host |
|
|
163
|
+
| `port` | int | Flask port |
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
### Plain Text Response
|
|
168
|
+
|
|
169
|
+
```python
|
|
170
|
+
staypresent.web.text("Hello World")
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
### JSON Response
|
|
176
|
+
|
|
177
|
+
```python
|
|
178
|
+
staypresent.web.json({
|
|
179
|
+
"hello": "world"
|
|
180
|
+
})
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Requirements
|
|
186
|
+
|
|
187
|
+
- Python 3.8+
|
|
188
|
+
- Flask
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Use Cases
|
|
193
|
+
|
|
194
|
+
- Telegram Bots
|
|
195
|
+
- Discord Bots
|
|
196
|
+
- Automation Scripts
|
|
197
|
+
- Background Workers
|
|
198
|
+
- Render Deployments
|
|
199
|
+
- Railway Deployments
|
|
200
|
+
- Koyeb Deployments
|
|
201
|
+
- Heroku Apps
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## License
|
|
206
|
+
|
|
207
|
+
MIT License
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
Made with ❤️ using Python.
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# StayPresent
|
|
2
|
+
|
|
3
|
+
A lightweight Python package that keeps your bot or script alive by running a small Flask web server alongside your application.
|
|
4
|
+
|
|
5
|
+
Perfect for platforms like **Render**, **Railway**, **Koyeb**, **Heroku**, or anywhere an HTTP server is required to keep your service active.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- 🚀 One-line setup
|
|
12
|
+
- 🌐 Built-in Flask web server
|
|
13
|
+
- 🤖 Runs your Python bot/script automatically
|
|
14
|
+
- 📄 Custom text response
|
|
15
|
+
- 📦 JSON response support
|
|
16
|
+
- ⚡ Lightweight and easy to use
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Installation
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pip install staypresent
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Or install locally:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
pip install .
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Basic Usage
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
import staypresent
|
|
38
|
+
|
|
39
|
+
staypresent.web.text("Made With ❤️")
|
|
40
|
+
|
|
41
|
+
staypresent.run("bot.py")
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Open your browser:
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
http://localhost:8080
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Response:
|
|
51
|
+
|
|
52
|
+
```
|
|
53
|
+
Made With ❤️
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## JSON Response
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
import staypresent
|
|
62
|
+
|
|
63
|
+
staypresent.web.json({
|
|
64
|
+
"status": "online",
|
|
65
|
+
"developer": "John",
|
|
66
|
+
"message": "Made With Love ❤️"
|
|
67
|
+
})
|
|
68
|
+
|
|
69
|
+
staypresent.run("bot.py")
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Response
|
|
73
|
+
|
|
74
|
+
```json
|
|
75
|
+
{
|
|
76
|
+
"status": "online",
|
|
77
|
+
"developer": "John",
|
|
78
|
+
"message": "Made With Love ❤️"
|
|
79
|
+
}
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Custom Port
|
|
85
|
+
|
|
86
|
+
```python
|
|
87
|
+
import staypresent
|
|
88
|
+
|
|
89
|
+
staypresent.run(
|
|
90
|
+
"bot.py",
|
|
91
|
+
port=5000
|
|
92
|
+
)
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
|
|
97
|
+
## Custom Host
|
|
98
|
+
|
|
99
|
+
```python
|
|
100
|
+
staypresent.run(
|
|
101
|
+
"bot.py",
|
|
102
|
+
host="0.0.0.0"
|
|
103
|
+
)
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## Complete Example
|
|
109
|
+
|
|
110
|
+
```python
|
|
111
|
+
import staypresent
|
|
112
|
+
|
|
113
|
+
staypresent.web.json({
|
|
114
|
+
"status": "Running",
|
|
115
|
+
"version": "1.0.0",
|
|
116
|
+
"message": "Made With Love ❤️"
|
|
117
|
+
})
|
|
118
|
+
|
|
119
|
+
staypresent.run(
|
|
120
|
+
"body.py",
|
|
121
|
+
host="0.0.0.0",
|
|
122
|
+
port=8080
|
|
123
|
+
)
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## API
|
|
129
|
+
|
|
130
|
+
### Run your bot
|
|
131
|
+
|
|
132
|
+
```python
|
|
133
|
+
staypresent.run(
|
|
134
|
+
bot_file,
|
|
135
|
+
host="0.0.0.0",
|
|
136
|
+
port=8080
|
|
137
|
+
)
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
| Parameter | Type | Description |
|
|
141
|
+
|-----------|------|-------------|
|
|
142
|
+
| `bot_file` | str | Path to your Python script |
|
|
143
|
+
| `host` | str | Flask host |
|
|
144
|
+
| `port` | int | Flask port |
|
|
145
|
+
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
### Plain Text Response
|
|
149
|
+
|
|
150
|
+
```python
|
|
151
|
+
staypresent.web.text("Hello World")
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
---
|
|
155
|
+
|
|
156
|
+
### JSON Response
|
|
157
|
+
|
|
158
|
+
```python
|
|
159
|
+
staypresent.web.json({
|
|
160
|
+
"hello": "world"
|
|
161
|
+
})
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
## Requirements
|
|
167
|
+
|
|
168
|
+
- Python 3.8+
|
|
169
|
+
- Flask
|
|
170
|
+
|
|
171
|
+
---
|
|
172
|
+
|
|
173
|
+
## Use Cases
|
|
174
|
+
|
|
175
|
+
- Telegram Bots
|
|
176
|
+
- Discord Bots
|
|
177
|
+
- Automation Scripts
|
|
178
|
+
- Background Workers
|
|
179
|
+
- Render Deployments
|
|
180
|
+
- Railway Deployments
|
|
181
|
+
- Koyeb Deployments
|
|
182
|
+
- Heroku Apps
|
|
183
|
+
|
|
184
|
+
---
|
|
185
|
+
|
|
186
|
+
## License
|
|
187
|
+
|
|
188
|
+
MIT License
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
Made with ❤️ using Python.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=69", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "staypresent"
|
|
7
|
+
version = "1.0.0"
|
|
8
|
+
description = "Run your Python bot alongside a lightweight Flask web server."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { text = "MIT" }
|
|
11
|
+
authors = [
|
|
12
|
+
{ name = "Ashish Sharma" }
|
|
13
|
+
]
|
|
14
|
+
requires-python = ">=3.8"
|
|
15
|
+
|
|
16
|
+
dependencies = [
|
|
17
|
+
"Flask>=3.0.0"
|
|
18
|
+
]
|
|
19
|
+
|
|
20
|
+
keywords = [
|
|
21
|
+
"flask",
|
|
22
|
+
"telegram",
|
|
23
|
+
"discord",
|
|
24
|
+
"bot",
|
|
25
|
+
"webserver",
|
|
26
|
+
"keepalive"
|
|
27
|
+
]
|
|
28
|
+
|
|
29
|
+
classifiers = [
|
|
30
|
+
"Programming Language :: Python :: 3",
|
|
31
|
+
"License :: OSI Approved :: MIT License",
|
|
32
|
+
"Operating System :: OS Independent"
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[project.urls]
|
|
36
|
+
Homepage = "https://github.com/NTDevLops/staypresent"
|
|
37
|
+
Repository = "https://github.com/NTDevLops/staypresent"
|
|
38
|
+
Issues = "https://github.com/NTDevLops/staypresent/issues"
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import subprocess
|
|
2
|
+
import threading
|
|
3
|
+
import logging
|
|
4
|
+
import signal
|
|
5
|
+
import sys
|
|
6
|
+
import os
|
|
7
|
+
|
|
8
|
+
from .server import app
|
|
9
|
+
|
|
10
|
+
logging.basicConfig(
|
|
11
|
+
level=logging.INFO,
|
|
12
|
+
format="%(asctime)s | %(levelname)-8s | %(message)s",
|
|
13
|
+
)
|
|
14
|
+
|
|
15
|
+
logger = logging.getLogger("staypresent")
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def _run_server():
|
|
19
|
+
app.run(host="0.0.0.0", port=8080)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
def run(bot_file: str):
|
|
23
|
+
"""
|
|
24
|
+
Starts Flask + Bot
|
|
25
|
+
|
|
26
|
+
Example:
|
|
27
|
+
staypresent.run("bot.py")
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
flask_thread = threading.Thread(target=_run_server, daemon=True)
|
|
31
|
+
flask_thread.start()
|
|
32
|
+
|
|
33
|
+
process = subprocess.Popen([sys.executable, bot_file])
|
|
34
|
+
|
|
35
|
+
def shutdown(*args):
|
|
36
|
+
logger.info("Stopping...")
|
|
37
|
+
process.terminate()
|
|
38
|
+
sys.exit(0)
|
|
39
|
+
|
|
40
|
+
signal.signal(signal.SIGINT, shutdown)
|
|
41
|
+
signal.signal(signal.SIGTERM, shutdown)
|
|
42
|
+
|
|
43
|
+
process.wait()
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: staypresent
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Run your Python bot alongside a lightweight Flask web server.
|
|
5
|
+
Author: Ashish Sharma
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/NTDevLops/staypresent
|
|
8
|
+
Project-URL: Repository, https://github.com/NTDevLops/staypresent
|
|
9
|
+
Project-URL: Issues, https://github.com/NTDevLops/staypresent/issues
|
|
10
|
+
Keywords: flask,telegram,discord,bot,webserver,keepalive
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Requires-Python: >=3.8
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Requires-Dist: Flask>=3.0.0
|
|
18
|
+
Dynamic: license-file
|
|
19
|
+
|
|
20
|
+
# StayPresent
|
|
21
|
+
|
|
22
|
+
A lightweight Python package that keeps your bot or script alive by running a small Flask web server alongside your application.
|
|
23
|
+
|
|
24
|
+
Perfect for platforms like **Render**, **Railway**, **Koyeb**, **Heroku**, or anywhere an HTTP server is required to keep your service active.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Features
|
|
29
|
+
|
|
30
|
+
- 🚀 One-line setup
|
|
31
|
+
- 🌐 Built-in Flask web server
|
|
32
|
+
- 🤖 Runs your Python bot/script automatically
|
|
33
|
+
- 📄 Custom text response
|
|
34
|
+
- 📦 JSON response support
|
|
35
|
+
- ⚡ Lightweight and easy to use
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Installation
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
pip install staypresent
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Or install locally:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
pip install .
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Basic Usage
|
|
54
|
+
|
|
55
|
+
```python
|
|
56
|
+
import staypresent
|
|
57
|
+
|
|
58
|
+
staypresent.web.text("Made With ❤️")
|
|
59
|
+
|
|
60
|
+
staypresent.run("bot.py")
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Open your browser:
|
|
64
|
+
|
|
65
|
+
```
|
|
66
|
+
http://localhost:8080
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
Response:
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
Made With ❤️
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## JSON Response
|
|
78
|
+
|
|
79
|
+
```python
|
|
80
|
+
import staypresent
|
|
81
|
+
|
|
82
|
+
staypresent.web.json({
|
|
83
|
+
"status": "online",
|
|
84
|
+
"developer": "John",
|
|
85
|
+
"message": "Made With Love ❤️"
|
|
86
|
+
})
|
|
87
|
+
|
|
88
|
+
staypresent.run("bot.py")
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Response
|
|
92
|
+
|
|
93
|
+
```json
|
|
94
|
+
{
|
|
95
|
+
"status": "online",
|
|
96
|
+
"developer": "John",
|
|
97
|
+
"message": "Made With Love ❤️"
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Custom Port
|
|
104
|
+
|
|
105
|
+
```python
|
|
106
|
+
import staypresent
|
|
107
|
+
|
|
108
|
+
staypresent.run(
|
|
109
|
+
"bot.py",
|
|
110
|
+
port=5000
|
|
111
|
+
)
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
---
|
|
115
|
+
|
|
116
|
+
## Custom Host
|
|
117
|
+
|
|
118
|
+
```python
|
|
119
|
+
staypresent.run(
|
|
120
|
+
"bot.py",
|
|
121
|
+
host="0.0.0.0"
|
|
122
|
+
)
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Complete Example
|
|
128
|
+
|
|
129
|
+
```python
|
|
130
|
+
import staypresent
|
|
131
|
+
|
|
132
|
+
staypresent.web.json({
|
|
133
|
+
"status": "Running",
|
|
134
|
+
"version": "1.0.0",
|
|
135
|
+
"message": "Made With Love ❤️"
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
staypresent.run(
|
|
139
|
+
"body.py",
|
|
140
|
+
host="0.0.0.0",
|
|
141
|
+
port=8080
|
|
142
|
+
)
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
---
|
|
146
|
+
|
|
147
|
+
## API
|
|
148
|
+
|
|
149
|
+
### Run your bot
|
|
150
|
+
|
|
151
|
+
```python
|
|
152
|
+
staypresent.run(
|
|
153
|
+
bot_file,
|
|
154
|
+
host="0.0.0.0",
|
|
155
|
+
port=8080
|
|
156
|
+
)
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
| Parameter | Type | Description |
|
|
160
|
+
|-----------|------|-------------|
|
|
161
|
+
| `bot_file` | str | Path to your Python script |
|
|
162
|
+
| `host` | str | Flask host |
|
|
163
|
+
| `port` | int | Flask port |
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
### Plain Text Response
|
|
168
|
+
|
|
169
|
+
```python
|
|
170
|
+
staypresent.web.text("Hello World")
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
---
|
|
174
|
+
|
|
175
|
+
### JSON Response
|
|
176
|
+
|
|
177
|
+
```python
|
|
178
|
+
staypresent.web.json({
|
|
179
|
+
"hello": "world"
|
|
180
|
+
})
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
---
|
|
184
|
+
|
|
185
|
+
## Requirements
|
|
186
|
+
|
|
187
|
+
- Python 3.8+
|
|
188
|
+
- Flask
|
|
189
|
+
|
|
190
|
+
---
|
|
191
|
+
|
|
192
|
+
## Use Cases
|
|
193
|
+
|
|
194
|
+
- Telegram Bots
|
|
195
|
+
- Discord Bots
|
|
196
|
+
- Automation Scripts
|
|
197
|
+
- Background Workers
|
|
198
|
+
- Render Deployments
|
|
199
|
+
- Railway Deployments
|
|
200
|
+
- Koyeb Deployments
|
|
201
|
+
- Heroku Apps
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## License
|
|
206
|
+
|
|
207
|
+
MIT License
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
Made with ❤️ using Python.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
pyproject.toml
|
|
4
|
+
staypresent/__init__.py
|
|
5
|
+
staypresent/runner.py
|
|
6
|
+
staypresent/server.py
|
|
7
|
+
staypresent/web.py
|
|
8
|
+
staypresent.egg-info/PKG-INFO
|
|
9
|
+
staypresent.egg-info/SOURCES.txt
|
|
10
|
+
staypresent.egg-info/dependency_links.txt
|
|
11
|
+
staypresent.egg-info/requires.txt
|
|
12
|
+
staypresent.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Flask>=3.0.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
staypresent
|