DinoPLayZ commited on
Commit
418d0e5
·
verified ·
1 Parent(s): 70b1a45

Updated the Endpoint

Browse files
Files changed (1) hide show
  1. main.py +28 -8
main.py CHANGED
@@ -13,6 +13,7 @@ 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)
@@ -741,15 +742,34 @@ async def fetch_latest_api():
741
 
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
 
755
  @app.get("/assistant")
 
13
 
14
  from contextlib import asynccontextmanager
15
  from fastapi import FastAPI, BackgroundTasks, Request
16
+ from fastapi.responses import HTMLResponse
17
  import uvicorn
18
 
19
  # Task 4 & 5 dependencies (Sendgrid API & Logging)
 
742
 
743
  return parse_event(resources[0])
744
 
745
+ @app.get("/", response_class=HTMLResponse)
746
  async def root(request: Request):
747
+ health_url = str(request.url_for("health_check"))
748
+ assistant_url = str(request.url_for("internal_assistant"))
749
+
750
+ return f"""
751
+ <!DOCTYPE html>
752
+ <html>
753
+ <head>
754
+ <title>BIP Auto Notifier</title>
755
+ <style>
756
+ body {{ font-family: monospace; background-color: #0d1117; color: #c9d1d9; padding: 20px; font-size: 14px; }}
757
+ a {{ color: #58a6ff; text-decoration: none; }}
758
+ a:hover {{ text-decoration: underline; }}
759
+ pre {{ background-color: #161b22; padding: 20px; border-radius: 6px; display: inline-block; }}
760
+ </style>
761
+ </head>
762
+ <body>
763
+ <pre>{{
764
+ "app": "BIP Auto Notifier",
765
+ "status": "healthy",
766
+ "message": "Background tracker running 🚀",
767
+ "health_endpoint": "<a href="{health_url}">{health_url}</a>",
768
+ "assistant_endpoint": "<a href="{assistant_url}">{assistant_url}</a>"
769
+ }}</pre>
770
+ </body>
771
+ </html>
772
+ """
773
 
774
 
775
  @app.get("/assistant")