MCPcopy
hub / github.com/hesreallyhim/awesome-claude-code / _header_int

Function _header_int

scripts/validation/validate_links.py:246–261  ·  view source on GitHub ↗

Parse integer headers with a safe fallback.

(headers: Mapping[str, object], key: str)

Source from the content-addressed store, hash-verified

244
245
246def _header_int(headers: Mapping[str, object], key: str) -> int:
247 """Parse integer headers with a safe fallback."""
248 raw = headers.get(key)
249 if raw is None:
250 return 0
251 if isinstance(raw, int):
252 return raw
253 if isinstance(raw, str | bytes | bytearray):
254 try:
255 return int(raw)
256 except ValueError:
257 return 0
258 try:
259 return int(str(raw))
260 except ValueError:
261 return 0
262
263
264def get_github_last_modified(owner: str, repo: str, path: str | None = None) -> str | None:

Callers 1

validate_urlFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected