2025-03-25 17:14:57 +00:00

34 lines
795 B
Python

from fastapi import APIRouter, HTTPException
prices = [] # In-memory storage
router = APIRouter()
@router.post("/petrol-price")
async def update_petrol_price(
price: float = 650.00,
state: str = "Lagos",
station: str = "NNPC"
):
"""Update petrol price endpoint"""
if price <= 0:
raise HTTPException(status_code=400, detail="Invalid price amount")
prices.append({
"price_per_litre": price,
"state": state,
"station": station,
"currency": "NGN",
"last_updated": "2024-01-19"
})
return {
"message": "Price updated successfully",
"price": price,
"state": state,
"station": station,
"features": {
"rate_limit": 100,
"expires_in": 3600
}
}