File size: 734 Bytes
38171fa
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"""
Interface for API clients
"""
from abc import ABC, abstractmethod


class DataClient(ABC):
    """
    Abstract class for API clients
    """

    @abstractmethod
    def extract(self):
        """
        Extract data from API
        """
        if self.api_url is None:
            raise Exception("No API URL provided")

    def transform(self):
        """
        Placeholder method for future transformation logic.
        """
        self.transformed_data = self.api_response

    @abstractmethod
    def load(self):
        """
        Load data into target model
        """
        raise Exception("No model to transform")

    def run(self) -> None:
        self.extract()
        self.transform()
        self.load()