mirror of
https://github.com/glomatico/votify.git
synced 2026-09-27 11:32:15 +02:00
17 lines
395 B
Python
17 lines
395 B
Python
from __future__ import annotations
|
|
|
|
import requests
|
|
|
|
|
|
def check_response(response: requests.Response):
|
|
try:
|
|
response.raise_for_status()
|
|
except requests.HTTPError:
|
|
_raise_response_exception(response)
|
|
|
|
|
|
def _raise_response_exception(response: requests.Response):
|
|
raise Exception(
|
|
f"Request failed with status code {response.status_code}: {response.text}"
|
|
)
|