MCPcopy
hub / github.com/benoitc/gunicorn / request

Function request

examples/dirty_example/test_stash_integration.py:26–35  ·  view source on GitHub ↗

Make HTTP request and return JSON response.

(path)

Source from the content-addressed store, hash-verified

24
25
26def request(path):
27 """Make HTTP request and return JSON response."""
28 url = f"{BASE_URL}{path}"
29 try:
30 with urllib.request.urlopen(url, timeout=10) as resp:
31 return json.loads(resp.read().decode())
32 except urllib.error.HTTPError as e:
33 return {"error": str(e), "code": e.code}
34 except urllib.error.URLError as e:
35 return {"error": str(e)}
36
37
38def test_stash_shared_state():

Callers 6

test_stash_shared_stateFunction · 0.70
test_stash_counterFunction · 0.70
test_stash_list_sessionsFunction · 0.70
test_stash_logoutFunction · 0.70
mainFunction · 0.70

Calls 2

decodeMethod · 0.80
readMethod · 0.45

Tested by

no test coverage detected