Moved back to sync and added logging

This commit is contained in:
alexander
2026-01-24 12:55:47 +01:00
parent e93e743f65
commit d81cd88cab
10 changed files with 217 additions and 77 deletions

View File

@@ -1,4 +1,3 @@
import hashlib
import httpx
import datetime
import os
@@ -9,13 +8,13 @@ def get_datestring() -> str:
return datetime.datetime.now().strftime("%d.%m.%y")
async def cache_cheatsheet(url, outdir: str) -> str | None:
def cache_cheatsheet(url, outdir: str) -> str | None:
print("Caching cheatsheet from", url)
try:
async with httpx.AsyncClient() as client:
r = await client.get(url, timeout=5.0)
with httpx.Client() as client:
r = client.get(url, timeout=5.0)
if not r.is_success and r.headers.get("Content-Type") != "application/pdf":
return None
except httpx.TimeoutException: