OOP

Define a class OpenWeatherMap.

class OpenWeatherMap(object):
    def __init__(self, api, location, unit):
        self.api = api
        self.location = location
        self.unit = unit
        self.lang = LANG
        self.appid = APPID
        self.timeout = TIMEOUT

Then define two classes CurrentWeather and DailyWeather to inherit OpenWeatherMap class.

class CurrentWeather(OpenWeatherMap):

    weather_history = {}

    def __init__(self, location, unit):
        super().__init__(OWM_CURRENT_API, location, unit)


class DailyWeather(OpenWeatherMap):
    def __init__(self, location, unit, date):
        super().__init__(OWM_DAILY_API, location, unit)
        self.date = date

results matching ""

    No results matching ""