# ---- logging ----------------------------------------------------------------- LOG_LEVEL = os.getenv("LOG_LEVEL", "info")
# Guess a filename from the URL if the remote server doesn't set one filename = payload.url.path.split("/")[-1] or "downloaded_file"
# Enforce a size cap – we read the `Content-Length` header when present content_length = resp.headers.get("Content-Length") if content_length and int(content_length) > settings.MAX_CONTENT_LENGTH: raise HTTPException( status_code=status.HTTP_413_REQUEST_ENTITY_TOO_LARGE, detail="Remote file exceeds the allowed size limit.", )
except httpx.RequestError as exc: raise HTTPException( status_code=status.HTTP_504_GATEWAY_TIMEOUT, detail=f"Error contacting remote host: exc", ) # app/main.py import time from collections import defaultdict from datetime import datetime, timedelta from typing import Dict
CMD ["gunicorn", "-k", "uvicorn
from .downloader import stream_remote_file from .config import settings
COPY . . ENV PORT=8000 EXPOSE 8000
# ---- logging ----------------------------------------------------------------- LOG_LEVEL = os.getenv("LOG_LEVEL", "info")
# Guess a filename from the URL if the remote server doesn't set one filename = payload.url.path.split("/")[-1] or "downloaded_file" heretic webdl
# Enforce a size cap – we read the `Content-Length` header when present content_length = resp.headers.get("Content-Length") if content_length and int(content_length) > settings.MAX_CONTENT_LENGTH: raise HTTPException( status_code=status.HTTP_413_REQUEST_ENTITY_TOO_LARGE, detail="Remote file exceeds the allowed size limit.", ) detail=f"Error contacting remote host: exc"
except httpx.RequestError as exc: raise HTTPException( status_code=status.HTTP_504_GATEWAY_TIMEOUT, detail=f"Error contacting remote host: exc", ) # app/main.py import time from collections import defaultdict from datetime import datetime, timedelta from typing import Dict heretic webdl
CMD ["gunicorn", "-k", "uvicorn
from .downloader import stream_remote_file from .config import settings
COPY . . ENV PORT=8000 EXPOSE 8000