Spaces:
Runtime error
Runtime error
Commit
·
a54a589
1
Parent(s):
3fefafb
Update main.py
Browse files
main.py
CHANGED
@@ -9,8 +9,6 @@ from fastapi import FastAPI
|
|
9 |
from fastapi.middleware.cors import CORSMiddleware
|
10 |
from fastapi.responses import FileResponse, HTMLResponse
|
11 |
|
12 |
-
from fastapi_cache import FastAPICache
|
13 |
-
from fastapi_cache.backends.memory_cache import MemoryCache
|
14 |
|
15 |
from pydantic import BaseModel
|
16 |
|
@@ -24,9 +22,7 @@ import available_data
|
|
24 |
|
25 |
app = FastAPI()
|
26 |
|
27 |
-
|
28 |
-
cache = MemoryCache()
|
29 |
-
FastAPICache.init(cache)
|
30 |
|
31 |
app.add_middleware(
|
32 |
CORSMiddleware,
|
@@ -248,7 +244,7 @@ async def events_available(year: int) -> any:
|
|
248 |
|
249 |
# @st.cache_data
|
250 |
@app.get("/{year}/{event}", response_model=None)
|
251 |
-
@
|
252 |
async def sessions_available(year: int, event: str | int) -> any:
|
253 |
# get sessions available for a given year and event
|
254 |
data = available_data.LatestData(year)
|
|
|
9 |
from fastapi.middleware.cors import CORSMiddleware
|
10 |
from fastapi.responses import FileResponse, HTMLResponse
|
11 |
|
|
|
|
|
12 |
|
13 |
from pydantic import BaseModel
|
14 |
|
|
|
22 |
|
23 |
app = FastAPI()
|
24 |
|
25 |
+
|
|
|
|
|
26 |
|
27 |
app.add_middleware(
|
28 |
CORSMiddleware,
|
|
|
244 |
|
245 |
# @st.cache_data
|
246 |
@app.get("/{year}/{event}", response_model=None)
|
247 |
+
@functools.cache
|
248 |
async def sessions_available(year: int, event: str | int) -> any:
|
249 |
# get sessions available for a given year and event
|
250 |
data = available_data.LatestData(year)
|