MCPcopy Create free account
hub / github.com/RASAAS/docmcp-knowledge / fetch_page

Function fetch_page

scripts/check_standards_versions.py:82–92  ·  view source on GitHub ↗

Fetch page content. Returns (status_code, html_text).

(url: str, max_bytes: int = 8000)

Source from the content-addressed store, hash-verified

80
81
82def fetch_page(url: str, max_bytes: int = 8000) -> tuple[int, str]:
83 """Fetch page content. Returns (status_code, html_text)."""
84 try:
85 req = Request(url, headers=HEADERS)
86 resp = urlopen(req, timeout=15)
87 content = resp.read(max_bytes).decode("utf-8", errors="ignore")
88 return resp.status, content
89 except HTTPError as e:
90 return e.code, ""
91 except (URLError, OSError) as e:
92 return 0, str(e)
93
94
95def check_iso(standard: dict) -> dict | None:

Callers 4

check_isoFunction · 0.85
check_iecFunction · 0.85
check_astmFunction · 0.85
check_itehFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected