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