This commit is contained in:
parent
881db673c7
commit
24a6a49598
12
api.py
12
api.py
@ -3,13 +3,21 @@ import os
|
|||||||
|
|
||||||
import requests
|
import requests
|
||||||
import uvicorn
|
import uvicorn
|
||||||
from fastapi.responses import FileResponse
|
|
||||||
from fastapi import FastAPI
|
from fastapi import FastAPI
|
||||||
from fastapi import FastAPI, Form
|
from fastapi.middleware.cors import CORSMiddleware
|
||||||
|
|
||||||
env = os.environ
|
env = os.environ
|
||||||
app = FastAPI()
|
app = FastAPI()
|
||||||
|
|
||||||
|
# 配置 CORS 中间件
|
||||||
|
app.add_middleware(
|
||||||
|
CORSMiddleware,
|
||||||
|
allow_origins=["*"], # 允许所有来源,可以根据需求进行配置
|
||||||
|
allow_credentials=True,
|
||||||
|
allow_methods=["*"], # 允许所有请求方法
|
||||||
|
allow_headers=["*"], # 允许所有请求头
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
# 榜单获取
|
# 榜单获取
|
||||||
@app.get("/get_rank")
|
@app.get("/get_rank")
|
||||||
|
Loading…
Reference in New Issue
Block a user