Python CSC Electronic Office
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.1 KiB

from abc import ABC, abstractmethod
from typing import Union
import requests
class StreamResponseHandler(ABC):
An abstract class to handle stream responses from the server.
The CLI and TUI should implement a child class.
def handle_non_200(self, resp: requests.Response):
"""Handle a non-200 response."""
def begin(self):
"""Begin the transaction."""
def handle_aborted(self, err_msg: str):
"""Handle an aborted transaction."""
def handle_completed(self):
"""Handle a completed transaction."""
def handle_successful_operation(self):
"""Handle a successful operation."""
def handle_failed_operation(self, err_msg: Union[str, None]):
"""Handle a failed operation."""
def handle_skipped_operation(self):
"""Handle a skipped operation."""
def handle_unrecognized_operation(self, operation: str):
"""Handle an unrecognized operation."""