MCPcopy Create free account
hub / github.com/GCWing/BitFun / http_get

Function http_get

src/apps/relay-server/test_incremental_upload.py:79–88  ·  view source on GitHub ↗

Returns (status_code, body_text).

(url: str)

Source from the content-addressed store, hash-verified

77
78
79def http_get(url: str) -> tuple:
80 """Returns (status_code, body_text)."""
81 try:
82 req = urllib.request.Request(url)
83 with urllib.request.urlopen(req, timeout=10) as resp:
84 return resp.status, resp.read().decode()
85 except urllib.error.HTTPError as e:
86 return e.code, e.read().decode() if e.fp else ""
87 except Exception as e:
88 return 0, str(e)
89
90
91def http_post_json(url: str, data: dict) -> tuple:

Callers 1

run_testsFunction · 0.85

Calls 1

readMethod · 0.45

Tested by

no test coverage detected