(enclosure: etree._Element, dest: Path)
| 37 | |
| 38 | |
| 39 | def download_enclosure(enclosure: etree._Element, dest: Path) -> None: |
| 40 | url = urljoin(APPCAST_URL, enclosure.attrib["url"]) |
| 41 | ed_signature = enclosure.attrib[sparkle_name("edSignature")] |
| 42 | |
| 43 | with requests.get(url, timeout=120) as resp: |
| 44 | resp.raise_for_status() |
| 45 | data = resp.content |
| 46 | |
| 47 | try: |
| 48 | verify_sparkle_signature(data, ed_signature) |
| 49 | except RuntimeError as e: |
| 50 | print(f"warning {e} for {url}") |
| 51 | |
| 52 | dest.parent.mkdir(parents=True, exist_ok=True) |
| 53 | dest.write_bytes(data) |
| 54 | |
| 55 | |
| 56 | def appcast_snapshot_path(output_root: Path) -> Path: |
no test coverage detected