add in-memory cache to /api/v1/api endpoint
This commit is contained in:
@@ -3,6 +3,7 @@ from typing import Optional, Dict, Any, Tuple
|
||||
from bs4 import BeautifulSoup
|
||||
from pydantic import BaseModel, Field
|
||||
from fastapi import APIRouter, Request
|
||||
from functools import lru_cache
|
||||
|
||||
from httpx import AsyncClient
|
||||
|
||||
@@ -166,6 +167,8 @@ class IPInfo:
|
||||
# ==================== Роутер ====================
|
||||
router = APIRouter(prefix='/api/v1', tags=['ip'])
|
||||
|
||||
|
||||
@lru_cache
|
||||
@router.get('/ip')
|
||||
async def get_ip(request: Request):
|
||||
forwarded = request.headers.get('X-Forwarded-For')
|
||||
|
||||
Reference in New Issue
Block a user