Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -14,11 +14,20 @@ start_time = time.time()
|
|
14 |
@app.route('/status', methods=['GET'])
|
15 |
def status():
|
16 |
global request_count
|
17 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
return jsonify({
|
19 |
"status": "API is running",
|
20 |
"total_requests": request_count,
|
21 |
-
"
|
22 |
})
|
23 |
|
24 |
# Generate API Key
|
|
|
14 |
@app.route('/status', methods=['GET'])
|
15 |
def status():
|
16 |
global request_count
|
17 |
+
uptime_seconds = int(time.time() - start_time)
|
18 |
+
|
19 |
+
# Convert uptime to days, hours, minutes, and seconds
|
20 |
+
days = uptime_seconds // 86400
|
21 |
+
hours = (uptime_seconds % 86400) // 3600
|
22 |
+
minutes = (uptime_seconds % 3600) // 60
|
23 |
+
seconds = uptime_seconds % 60
|
24 |
+
|
25 |
+
uptime_str = f"{days} days, {hours} hours, {minutes} minutes and {seconds} seconds"
|
26 |
+
|
27 |
return jsonify({
|
28 |
"status": "API is running",
|
29 |
"total_requests": request_count,
|
30 |
+
"uptime": uptime_str
|
31 |
})
|
32 |
|
33 |
# Generate API Key
|