oauth-backend/runner/backend/__init__.py
2025-06-26 10:43:52 +09:00

23 lines
625 B
Python

from fastapi import FastAPI, Query, HTTPException
from fastapi.responses import Response
import lib.cur_target_url as cur_target_url
app = FastAPI()
@app.post("/start")
async def start(url: str = Query(None)):
if url:
cur_target_url.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)