Code cleanup phase 2
This commit is contained in:
23
ota.py
23
ota.py
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user