13 lines
339 B
Python
13 lines
339 B
Python
from fastapi import FastAPI, Response
|
|
from generator import generate
|
|
from cachetools import cached, TTLCache
|
|
import math
|
|
|
|
app = FastAPI()
|
|
|
|
@app.get("/")
|
|
@cached(cache=TTLCache(maxsize=math.inf, ttl=3600))
|
|
def read_root(url: str):
|
|
atom = generate(url)
|
|
return Response(content=atom, media_type='application/atom+xml; charset=utf-8')
|