File tree Expand file tree Collapse file tree 1 file changed +1
-24
lines changed Expand file tree Collapse file tree 1 file changed +1
-24
lines changed Original file line number Diff line number Diff line change 11import time
22
3- from fastapi import APIRouter , FastAPI , Request
3+ from fastapi import FastAPI , Request
44from fastapi .middleware .cors import CORSMiddleware
5- from fastapi .responses import RedirectResponse
65from loguru import logger
76
87from app .config import get_yaml_config
@@ -45,25 +44,3 @@ async def log_requests(request: Request, call_next):
4544 t2 = time .time ()
4645 logger .info (f"Cost { (t2 - t1 ) * 1e3 :.2f} ms { response .status_code = } " )
4746 return response
48-
49-
50- # Redirect Old API to new one
51- legacy_router = APIRouter (
52- tags = ["legacy_apis" ],
53- )
54-
55-
56- @legacy_router .post ("/predict_records" )
57- async def legacy_predicted_rating (request : Request ):
58- """
59- This api is a legacy api for third-party projects like https://github.com/XYShaoKang/refined-leetcode
60- Just do nothing but redirecting to new API
61- :return:
62- """
63- base_url = str (request .base_url )[:- 1 ]
64- new_path = app .url_path_for ("predicted_rating" )
65- new_url = base_url + new_path
66- return RedirectResponse (new_url )
67-
68-
69- app .include_router (legacy_router )
You can’t perform that action at this time.
0 commit comments