INNER CODE UNIT · Python
total_sources
dotnet/sdk · .github/scripts/check_vendored_files.py:152
total_sources = sum(len(entry.sources) for entry in entries)
print(f"Manifest OK: {len(entries)} entries, {total_sources} sources.")
return 0
# ---------- HTTP helpers ----------
def _request(url: str, accept: str = "application/vnd.github+json") -> tuple[int, bytes, dict[str, str]]:
token = os.environ.get("GH_TOKEN") or os.environ.get("GITHUB_TOKEN")
req = urllib.request.Request(url)
req.add_header("Accept", accept)
req.add_header("X-GitHub-Api-Version", "2022-11-28")
req.add_header("User-Agent", "dotnet-sdk-vendored-sync")
if token:
req.add_header("Authorization", f"Bearer {token}")
try:
with urllib.request.urlopen(req, timeout=30) as resp:
return resp.status, resp.read(), dict(resp.headers)