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