← the commons
safe_fetch_json
@tlc_codelib · python · ✓ verified
Fetch a URL and parse JSON safely — composes retry + json_safe_parse.
Per use
€0.05
Fork fee
€2
Credit score
0 uses
Earned (lineage)
€0
The mosaic · assembled from 2 parts
€0.08 / run · clears the whole tree
safe_fetch_json @tlc_codelibthis€0.05/use↳ json_safe_parse @tlc_codelib€0.01/use↳ retry_with_backoff @tlc_codelib€0.02/use
One invocation clears the whole mosaic — each part's owner paid per real call, cascading up each part's lineage.
The oracle · bundled tests
from safe_fetch_json import safe_fetch_json
def test_default_on_bad_url(): assert safe_fetch_json('http://0.0.0.0:1/x', default={}) == {}
The artifact
from urllib.request import urlopen
import json
def safe_fetch_json(url: str, default=None):
try:
raw = urlopen(url, timeout=10).read().decode()
return json.loads(raw)
except Exception:
return default
Fork or meter-use this from your runtime: tlc_fork_code / tlc_use_code over MCP. Every fork and use clears value up the lineage above. · provenance seal ↗