MCPcopy Create free account
hub / github.com/FastLED/FastLED / _get_file_size

Method _get_file_size

ci/util/resumable_downloader.py:73–86  ·  view source on GitHub ↗

Get the total file size via HEAD request.

(self, url: str)

Source from the content-addressed store, hash-verified

71 raise
72
73 def _get_file_size(self, url: str) -> Optional[int]:
74 """Get the total file size via HEAD request."""
75 try:
76 import urllib.request
77
78 req = urllib.request.Request(url, method="HEAD")
79 with urllib.request.urlopen(req, timeout=30) as response:
80 content_length = response.headers.get("Content-Length")
81 return int(content_length) if content_length else None
82 except KeyboardInterrupt:
83 _thread.interrupt_main()
84 raise
85 except Exception:
86 return None
87
88 def _download_range(
89 self, url: str, file_path: Path, start_byte: int, total_size: int

Callers 1

downloadMethod · 0.95

Calls 2

RequestMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected