chore: update
This commit is contained in:
@@ -2,12 +2,14 @@
|
||||
Lightweight Python API service for signature validation
|
||||
This can run independently to support the PHP application
|
||||
"""
|
||||
from fastapi import FastAPI, Query
|
||||
from fastapi.responses import JSONResponse
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from bibapi import catalogue
|
||||
import re
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
from bibapi import catalogue
|
||||
from fastapi import FastAPI, Query
|
||||
from fastapi.middleware.cors import CORSMiddleware
|
||||
from fastapi.responses import JSONResponse
|
||||
|
||||
app = FastAPI(title="Signature Validation API")
|
||||
|
||||
@@ -23,6 +25,7 @@ app.add_middleware(
|
||||
# Initialize catalogue for signature validation
|
||||
cat = catalogue.Catalogue()
|
||||
|
||||
|
||||
@app.get("/api/validate-signature")
|
||||
async def validate_signature(signature: str = Query(...)):
|
||||
"""Validate a book signature and return total pages"""
|
||||
@@ -53,15 +56,18 @@ async def validate_signature(signature: str = Query(...)):
|
||||
"error": f"Fehler bei der Validierung: {str(e)}",
|
||||
"signature": signature,
|
||||
},
|
||||
status_code=500
|
||||
status_code=500,
|
||||
)
|
||||
|
||||
|
||||
@app.get("/health")
|
||||
async def health_check():
|
||||
"""Health check endpoint"""
|
||||
return {"status": "ok", "service": "signature-validation"}
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
import uvicorn
|
||||
|
||||
port = int(os.getenv("API_PORT", "8001"))
|
||||
uvicorn.run(app, host="0.0.0.0", port=port)
|
||||
|
||||
Reference in New Issue
Block a user