Make HTTP request and return JSON response.
(path)
| 24 | |
| 25 | |
| 26 | def 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 | |
| 38 | def test_stash_shared_state(): |
no test coverage detected