MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / safe_fetch_text

Function safe_fetch_text

graphify/security.py:317–323  ·  view source on GitHub ↗

Fetch *url* and return decoded text (UTF-8, replacing bad bytes). Wraps safe_fetch with tighter defaults for HTML / text content.

(url: str, max_bytes: int = _MAX_TEXT_BYTES, timeout: int = 15)

Source from the content-addressed store, hash-verified

315
316
317def safe_fetch_text(url: str, max_bytes: int = _MAX_TEXT_BYTES, timeout: int = 15) -> str:
318 """Fetch *url* and return decoded text (UTF-8, replacing bad bytes).
319
320 Wraps safe_fetch with tighter defaults for HTML / text content.
321 """
322 raw = safe_fetch(url, max_bytes=max_bytes, timeout=timeout)
323 return raw.decode("utf-8", errors="replace")
324
325
326# ---------------------------------------------------------------------------

Callers 4

_fetch_htmlFunction · 0.90
_fetch_tweetFunction · 0.90

Calls 1

safe_fetchFunction · 0.85