class WeatherGrapper: def __init__(self, src, dest, departure_time): self._owm = pyowm.OWM(API_KEY) self._src = Airport(src) self._dest = Airport(dest) self._dep_hour, self._dep_minute = departure_time.split(":") distance_btn_src_dst = vincenty(self._src.lat_lng(), self._dest.lat_lng()).miles self._approx_duration = distance_btn_src_dst/COMMERCIAL_AIRPLANE_SPEED + TIME_FOR_TAKING_OFF_AND_LANDING def src_weather(self): forecast = self._owm.daily_forecast(self._src.location()) t = datetime.today() wanted_time = datetime(t.year, t.month, t.day, int(self._dep_hour), int(self._dep_minute)) return (forecast.get_weather_at(wanted_time), grab_visibility(self._src.icao())) def dest_weather(self): forecast = self._owm.daily_forecast(self._dest.location()) t = datetime.today() wanted_time = datetime(t.year, t.month, t.day, int(self._dep_hour), int(self._dep_minute)) + timedelta(hours=self._approx_duration) return (forecast.get_weather_at(wanted_time), grab_visibility(self._dest.icao()))