(url: str, timeout: float)
| 17 | |
| 18 | |
| 19 | def request_json(url: str, timeout: float) -> dict: |
| 20 | request = urllib.request.Request(url, headers={"Accept": "application/json"}) |
| 21 | with urllib.request.urlopen(request, timeout=timeout) as response: |
| 22 | return json.loads(response.read().decode("utf-8")) |
| 23 | |
| 24 | |
| 25 | def download_if_needed(path: Path, sample_url: str, timeout: float) -> None: |