mirror of
https://github.com/ThePhaseless/Byparr.git
synced 2025-03-15 09:50:20 +08:00
do not override previous
This commit is contained in:
parent
aa9cf29755
commit
7a39415c5e
2
.github/workflows/docker-publish.yml
vendored
2
.github/workflows/docker-publish.yml
vendored
@ -93,7 +93,7 @@ jobs:
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: error-screenshots
|
||||
path: ./errors
|
||||
path: ./errors/*
|
||||
|
||||
# Sign the resulting Docker image digest except on PRs.
|
||||
# This will only write to the public Rekor transparency log when the Docker
|
||||
|
6
main.py
6
main.py
@ -3,6 +3,7 @@ from __future__ import annotations
|
||||
import asyncio
|
||||
import logging
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
import uvicorn
|
||||
import uvicorn.config
|
||||
@ -39,7 +40,10 @@ async def read_item(request: LinkRequest):
|
||||
try:
|
||||
challenged = await asyncio.wait_for(bypass_cloudflare(page), timeout=timeout)
|
||||
except asyncio.TimeoutError as e:
|
||||
await page.save_screenshot("errors/error.png")
|
||||
i = 0
|
||||
while Path(f"errors/error{i}.png").is_file():
|
||||
i += 1
|
||||
await page.save_screenshot(f"errors/error{i}.png")
|
||||
raise HTTPException(detail="Timeout", status_code=408) from e
|
||||
|
||||
logger.info(f"Got webpage: {request.url}")
|
||||
|
Loading…
x
Reference in New Issue
Block a user