40 lines
1.2 KiB
Python
40 lines
1.2 KiB
Python
from fastapi import APIRouter, Depends, HTTPException
|
|
from core.database import fake_users_db
|
|
import uuid
|
|
|
|
router = APIRouter()
|
|
|
|
@router.post("/api/v1/endpoint")
|
|
async def process_endpoint(
|
|
text: str = "allllllllllllllaaaallalallalalallalalallalallalalallalallalalalalalalalalaallalalalalalalalalalalalalallalalallalalalalallalallalalalalalallalalalallalalallalalalallalalalallalalallalalal"
|
|
):
|
|
"""Process text pattern endpoint"""
|
|
|
|
if not text or len(text) < 10:
|
|
raise HTTPException(status_code=400, detail="Text must be at least 10 characters long")
|
|
|
|
request_id = str(uuid.uuid4())
|
|
|
|
# Store the request in fake database
|
|
fake_users_db[request_id] = {
|
|
"text": text,
|
|
"pattern_length": len(text),
|
|
"timestamp": "2024-01-01T00:00:00Z" # Demo timestamp
|
|
}
|
|
|
|
return {
|
|
"message": "Pattern processed successfully",
|
|
"request_id": request_id,
|
|
"analysis": {
|
|
"length": len(text),
|
|
"pattern": "repeating_characters",
|
|
"status": "processed"
|
|
},
|
|
"metadata": {
|
|
"processing_time": "0.001s",
|
|
"character_frequency": {
|
|
"a": text.count("a"),
|
|
"l": text.count("l")
|
|
}
|
|
}
|
|
} |