"""Requests to ows-abacus-event.""" from typing import List from src.connectors.requests import get from src.exceptions import OwsEventException from src.models import Event SERVICE = 'ows-abacus-event' def get_events_by_target_type(target_type: str, target_id: int) -> List[Event]: """Get events for the specific target.""" path = f'/abacus-event/{target_type}/{target_id}' response = get(SERVICE, path) if response.status_code != 200: raise OwsEventException(f'ERROR in GET {path}') return [Event.model_validate(elem) for elem in response.json()]