Code cleanup phase 2

This commit is contained in:
2026-04-13 22:35:49 +02:00
parent 44af62d7a5
commit bd07318fe2
3 changed files with 34 additions and 34 deletions

23
ota.py
View File

@@ -198,18 +198,19 @@ def _fetch_manifest():
)
try:
r = urequests.get(url, headers=_headers())
if r.status_code == 200:
data = r.json()
r.close()
if data.get("content"):
import ubinascii
try:
if r.status_code == 200:
data = r.json()
if data.get("content"):
import ubinascii
content = ubinascii.a2b_base64(data["content"]).decode()
patterns = [line.strip() for line in content.splitlines()]
return [p for p in patterns if p and not p.startswith("#")]
else:
warn(f"Manifest not found at {OTA_MANIFEST}")
r.close()
content = ubinascii.a2b_base64(data["content"]).decode()
patterns = [line.strip() for line in content.splitlines()]
return [p for p in patterns if p and not p.startswith("#")]
else:
warn(f"Manifest not found at {OTA_MANIFEST}")
finally:
r.close()
except Exception as e:
log_err(f"Failed to fetch manifest: {e}")
return None