def fetch(station: str) -> str: """ Returns TAF report string or raises an error Maintains backwards compatability but uses the new Request object """ return service.get_service(station)('taf').fetch(station)
def __init__(self, icao: str): # Raises a BadStation error if needed station.valid_station(icao) self.station = icao self.station_info = Station.from_icao(icao) self.service = service.get_service(icao, self.station_info.country)( self.__class__.__name__.lower())
def fetch(station: str) -> str: """ Returns METAR report string or raises an error Maintains backwards compatability but uses the new Service object. It is recommended to use the Service class directly instead of this function """ return service.get_service(station)('metar').fetch(station)
def __init__(self, station: str): # Raises a BadStation error if needed valid_station(station) #: Service object used to fetch the report string self.service = service.get_service(station)(self.__class__.__name__.lower()) #: 4-character ICAO station ident code the report was initialized with self.station = station
def __init__(self, station: str): # Raises a BadStation error if needed valid_station(station) #: Service object used to fetch the report string self.service = service.get_service(station)( self.__class__.__name__.lower()) #: 4-character ICAO station ident code the report was initialized with self.station = station
def test_get_service(self): """ Tests that the correct service class is returned """ for stations, serv in ( (("KJFK", "EGLL", "PHNL"), service.NOAA), (("RKSI",), service.AMO), (("SKBO", "SKPP"), service.MAC), ): for station in stations: self.assertIsInstance(service.get_service(station)("metar"), serv)
def test_get_service(self): """ Tests that the correct service class is returned """ for stations, serv in ( (('KJFK', 'EGLL', 'PHNL'), service.NOAA), (('RKSI', ), service.AMO), (('SKBO', 'SKPP'), service.MAC), ): for station in stations: self.assertIsInstance( service.get_service(station)('metar'), serv)
def test_get_service(self): """Tests that the correct service class is returned""" for stations, country, serv in ( (("KJFK", "PHNL"), "US", service.NOAA), (("EGLL", ), "GB", service.NOAA), (("RKSI", ), "KR", service.AMO), (("SKBO", "SKPP"), "CO", service.MAC), (("YWOL", "YSSY"), "AU", service.AUBOM), ): for station in stations: self.assertIsInstance( service.get_service(station, country)("metar"), serv)
def __init__(self, icao: str): super().__init__(icao) self.service = get_service(icao, self.station.country)( self.__class__.__name__.lower())
def __init__(self, station_ident: str): # Raises a BadStation error if needed station.valid_station(station_ident) self.service = service.get_service(station_ident)( self.__class__.__name__.lower()) self.station = station_ident
def __init__(self, station: str): valid_station(station) self.service = service.get_service(station)( self.__class__.__name__.lower()) self.station = station