示例#1
0
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)
示例#2
0
 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())
示例#3
0
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)
示例#4
0
    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
示例#5
0
    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
示例#6
0
 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)
示例#7
0
 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)
示例#8
0
 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)
示例#9
0
 def __init__(self, icao: str):
     super().__init__(icao)
     self.service = get_service(icao, self.station.country)(
         self.__class__.__name__.lower())
示例#10
0
 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
示例#11
0
 def __init__(self, station: str):
     valid_station(station)
     self.service = service.get_service(station)(
         self.__class__.__name__.lower())
     self.station = station