From e34087694e3bb3729a4a1ab2f37103b8c2a7820d Mon Sep 17 00:00:00 2001 From: Paul van Genuchten Date: Fri, 31 May 2024 14:37:11 +0200 Subject: [PATCH] initial implementation of results by url --- src/api.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/api.py b/src/api.py index 2e4c15a..50b5977 100644 --- a/src/api.py +++ b/src/api.py @@ -3,6 +3,7 @@ from databases import Database from typing import List from pydantic import BaseModel +from urllib.parse import unquote import asyncpg import os @@ -89,6 +90,13 @@ async def get_non_empty_warnings(): data = await fetch_data(query=query) return data +# Endpoint to retrieve data with client error statuses +@app.get('/status/{item:path}', response_model=List[StatusResponse]) +async def get_status_for_url(item): + query = "SELECT * FROM linkchecker_output WHERE urlname = :item" + data = await fetch_data(query=query, values={'item': item }) + return data + # Start the application @app.on_event('startup') async def startup():