feat: initial commit

This commit is contained in:
2026-04-18 08:59:04 +02:00
commit 862c0d1703
32 changed files with 8492 additions and 0 deletions

29
service/main.py Normal file
View File

@@ -0,0 +1,29 @@
from __future__ import annotations
import os
from fastapi import Depends, FastAPI, HTTPException, Request, Security
from fastapi.security.api_key import APIKeyHeader
from .routers import health_router, scrape_router
API_KEY = os.getenv("API_KEY", "")
api_key_header = APIKeyHeader(name="X-API-Key", auto_error=False)
async def verify_api_key(key: str | None = Security(api_key_header)) -> None:
if API_KEY and key != API_KEY:
raise HTTPException(status_code=401, detail="Invalid or missing API key")
app = FastAPI(
title="Scrapling Service",
description="HTTP microservice exposing Scrapling web-scraping fetcherss to n8n",
version="0.1.0",
)
app.include_router(health_router)
app.include_router(
scrape_router,
dependencies=[Depends(verify_api_key)],
)