"""Requests to ows-abacus-event.""" from src.connectors.exceptions import OwsEventException from src.connectors.requests import post from src.models import Event SERVICE = 'ows-abacus-event' def create_event(event_name: str, target_type: str, target_id: int) -> Event: """Create Abacus event.""" path = '/abacus-event/' response = post( SERVICE, path, {'event_name': event_name, 'target_type': target_type, 'target_id': target_id}, ) if response.status_code != 201: raise OwsEventException(f'ERROR in POST {path}') return Event.model_validate(response.json())