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

Function check_astm

scripts/check_standards_versions.py:200–220  ·  view source on GitHub ↗

Check ASTM page for withdrawal/historical status.

(standard: dict)

Source from the content-addressed store, hash-verified

198
199
200def check_astm(standard: dict) -> dict | None:
201 """Check ASTM page for withdrawal/historical status."""
202 status, html = fetch_page(standard["url"])
203 if status == 404:
204 return {"type": "error", "detail": "HTTP 404 - page not found"}
205 if status != 200:
206 return {"type": "error", "detail": f"HTTP {status}"}
207
208 # Signal: "Historical" or "Withdrawn" in status
209 if re.search(r"\bHistorical\b", html):
210 superseded = re.search(r"Superseded\s*(?:by)?\s*([A-Z]\d[\w\-]+)", html)
211 return {
212 "type": "withdrawn",
213 "signal": f"Historical/Withdrawn. {superseded.group(0) if superseded else ''}".strip(),
214 "new_version": superseded.group(1) if superseded else "",
215 }
216
217 if re.search(r"\bWithdrawn\b", html, re.IGNORECASE):
218 return {"type": "withdrawn", "signal": "Withdrawn"}
219
220 return None
221
222
223def check_iteh(standard: dict) -> dict | None:

Callers

nothing calls this directly

Calls 2

fetch_pageFunction · 0.85
searchMethod · 0.45

Tested by

no test coverage detected