sp-hydra-veil-core/core/controllers/LocationController.py
2024-09-11 19:39:33 +02:00

22 lines
510 B
Python

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)