tianruci commited on
Commit
5d9ca1e
·
verified ·
1 Parent(s): 9c20da9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -6
app.py CHANGED
@@ -7,7 +7,6 @@ from fastapi.middleware.cors import CORSMiddleware
7
  from fastmcp.server import FastMCP
8
  from contextlib import asynccontextmanager
9
  from typing import List, Dict, Optional
10
- from fastapi.responses import JSONResponse
11
 
12
  # 初始化 MCP 服务器(必须在 FastAPI 之前)
13
  mcp_server = FastMCP(name="GitHubTrendingAPI")
@@ -85,8 +84,4 @@ async def root():
85
  async def get_trending(num: int = 10):
86
  if not cached_trending:
87
  await fetch_github_trending()
88
- return {"trending": cached_trending[:num]}
89
-
90
- @app.exception_handler(404)
91
- async def custom_404_handler(request, exc):
92
- return JSONResponse(status_code=404, content={"detail": "Custom Not Found: Check path"})
 
7
  from fastmcp.server import FastMCP
8
  from contextlib import asynccontextmanager
9
  from typing import List, Dict, Optional
 
10
 
11
  # 初始化 MCP 服务器(必须在 FastAPI 之前)
12
  mcp_server = FastMCP(name="GitHubTrendingAPI")
 
84
  async def get_trending(num: int = 10):
85
  if not cached_trending:
86
  await fetch_github_trending()
87
+ return {"trending": cached_trending[:num]}