from fastapi import FastAPI, Query, HTTPException from fastapi.responses import Response import lib.target as target app = FastAPI() @app.post("/start") async def start(url: str = Query(None)): if url: target.save(url) print(f"Target URL set to: {url}") return {"message": f"Target URL set to: {url}"} return {"error": "No URL provided"} @app.exception_handler(404) async def not_found_handler(request, exc): return Response(status_code=404) @app.exception_handler(405) async def method_not_allowed_handler(request, exc): return Response(status_code=405)