|
""" |
|
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() |
|
|