Spaces:
Sleeping
Sleeping
Updated the Health check Endpoints
Browse files
main.py
CHANGED
|
@@ -12,7 +12,7 @@ import threading
|
|
| 12 |
import asyncio
|
| 13 |
|
| 14 |
from contextlib import asynccontextmanager
|
| 15 |
-
from fastapi import FastAPI, BackgroundTasks
|
| 16 |
import uvicorn
|
| 17 |
|
| 18 |
# Task 4 & 5 dependencies (Sendgrid API & Logging)
|
|
@@ -742,13 +742,13 @@ async def fetch_latest_api():
|
|
| 742 |
return parse_event(resources[0])
|
| 743 |
|
| 744 |
@app.get("/")
|
| 745 |
-
async def root():
|
| 746 |
return {
|
| 747 |
"app": "BIP Auto Notifier",
|
| 748 |
"status": "healthy",
|
| 749 |
"message": "Background tracker running 🚀",
|
| 750 |
-
"health_endpoint": "
|
| 751 |
-
"assistant_endpoint": "
|
| 752 |
}
|
| 753 |
|
| 754 |
|
|
@@ -809,5 +809,4 @@ if __name__ == "__main__":
|
|
| 809 |
else:
|
| 810 |
# Default behavior: run FastAPI
|
| 811 |
port = int(os.getenv("PORT", 7860))
|
| 812 |
-
uvicorn.run(app, host="0.0.0.0", port=port, log_level="warning")
|
| 813 |
-
|
|
|
|
| 12 |
import asyncio
|
| 13 |
|
| 14 |
from contextlib import asynccontextmanager
|
| 15 |
+
from fastapi import FastAPI, BackgroundTasks, Request
|
| 16 |
import uvicorn
|
| 17 |
|
| 18 |
# Task 4 & 5 dependencies (Sendgrid API & Logging)
|
|
|
|
| 742 |
return parse_event(resources[0])
|
| 743 |
|
| 744 |
@app.get("/")
|
| 745 |
+
async def root(request: Request):
|
| 746 |
return {
|
| 747 |
"app": "BIP Auto Notifier",
|
| 748 |
"status": "healthy",
|
| 749 |
"message": "Background tracker running 🚀",
|
| 750 |
+
"health_endpoint": str(request.url_for("health_check")),
|
| 751 |
+
"assistant_endpoint": str(request.url_for("internal_assistant"))
|
| 752 |
}
|
| 753 |
|
| 754 |
|
|
|
|
| 809 |
else:
|
| 810 |
# Default behavior: run FastAPI
|
| 811 |
port = int(os.getenv("PORT", 7860))
|
| 812 |
+
uvicorn.run(app, host="0.0.0.0", port=port, log_level="warning")
|
|
|