mirror of
https://github.com/ThePhaseless/Byparr.git
synced 2025-03-15 09:50:20 +08:00
add healthcheck
This commit is contained in:
parent
5a40851c22
commit
4e6fbe0e95
12
main.py
12
main.py
@ -24,6 +24,18 @@ def read_root():
|
|||||||
return RedirectResponse(url="/docs", status_code=301)
|
return RedirectResponse(url="/docs", status_code=301)
|
||||||
|
|
||||||
|
|
||||||
|
@app.get("/health")
|
||||||
|
async def health_check():
|
||||||
|
"""Health check endpoint."""
|
||||||
|
logger.info("Health check")
|
||||||
|
browser = await new_browser()
|
||||||
|
await browser.grant_all_permissions()
|
||||||
|
page = await browser.get("https://google.com")
|
||||||
|
await page.bring_to_front()
|
||||||
|
browser.stop()
|
||||||
|
return {"status": "ok"}
|
||||||
|
|
||||||
|
|
||||||
@app.post("/v1")
|
@app.post("/v1")
|
||||||
async def read_item(request: LinkRequest):
|
async def read_item(request: LinkRequest):
|
||||||
"""Handle POST requests."""
|
"""Handle POST requests."""
|
||||||
|
@ -35,3 +35,8 @@ def test_bypass(website: str):
|
|||||||
)
|
)
|
||||||
|
|
||||||
assert response.status_code == HTTPStatus.OK
|
assert response.status_code == HTTPStatus.OK
|
||||||
|
|
||||||
|
|
||||||
|
def test_health_check():
|
||||||
|
response = client.get("/health")
|
||||||
|
assert response.status_code == HTTPStatus.OK
|
||||||
|
Loading…
x
Reference in New Issue
Block a user