from core.models.Location import Location from core.services.WebServiceApiService import WebServiceApiService from typing import Optional class LocationController: @staticmethod def get(code: str): return Location.find(code) @staticmethod def get_all(): return Location.all() @staticmethod def fetch(proxies: Optional[dict] = None): locations = WebServiceApiService.get_locations(proxies) Location.truncate() Location.save_many(locations)