autotako

Service to monitor moombox for completed livestream downloads to upload for distribution
git clone https://code.alwayswait.ing/autotako
Log | Files | Refs | README

commit 7a82db3426fd372918afc589ed6d45eb97ee434e
parent f60b975bec55819071d617d9ea68c757ec4d76ac
Author: archiveanon <>
Date:   Sun, 29 Jun 2025 15:14:02 +0000

Retry WebDAV upload

Diffstat:
Msrc/autotako/job_render.py | 19++++++++++++++-----
1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/src/autotako/job_render.py b/src/autotako/job_render.py @@ -275,11 +275,20 @@ async def do_gofile_upload(job: MoomboxJobInfo): async def do_webdav_upload(webdav: WebDavConfig, filepath: pathlib.Path, target: str): auth = httpx.BasicAuth(username=webdav.username, password=webdav.password) async with httpx.AsyncClient(auth=auth) as client: - dest = f"{webdav.base_url}/{target}" - file_check = await client.head(dest) - if file_check.status_code == httpx.codes.NOT_FOUND: - with filepath.open("rb") as fh: - await client.put(dest, content=fh.read()) + connection_warning_seen = False + while True: + try: + dest = f"{webdav.base_url}/{target}" + file_check = await client.head(dest) + if file_check.status_code == httpx.codes.NOT_FOUND: + with filepath.open("rb") as fh: + await client.put(dest, content=fh.read()) + return + except httpx.ConnectTimeout: + if not connection_warning_seen: + print(f"Failed to connect to {webdav.base_url}. Retrying...") + connection_warning_seen = True + await asyncio.sleep(10) async def _process_job(jobid):