def get_weather():
    city = id = ""
    lat, lon = wa.get_current_lat_lon()
    # Call api from www.openweathermap.org
    w, f = wa.get_weather_dicts(lat, lon, city, id)
    w = wa.get_current_weather(w)
    f = wa.get_forecast(f)
    fmt = "{}\n{}\nWeather information provided by openweathermap.org"
    return fmt.format(w, f)
def get_weather():
    print('=' * 20)
    try:
        w, f = wa.pick_your_weather()
    except requests.ConnectionError or ValueError:
        print('=' * 20)
        sys.exit('Weather servers are busy. Try again in a few minutes...')

    # Call functions in WeatherAnywhere.py to retrieve weather data
    weather = wa.get_current_weather(w, f)
    forecast = wa.get_forecast(w, f)
    fmt = '{}\n\nWeather information provided by api.wunderground.com'
    forecast = fmt.format(forecast)
    return w, f, weather, forecast
def get_weather():
  print('=' * 20)
  try:
    w, f = wa.pick_your_weather()
  except requests.ConnectionError or ValueError:
    print('=' * 20)
    sys.exit('Weather servers are busy. Try again in a few minutes...')

  # Call functions in WeatherAnywhere.py to retrieve weather data
  weather = wa.get_current_weather(w)
  forecast = wa.get_forecast(w,f)
  fmt = '{}\n\nWeather information provided by api.wunderground.com'
  forecast = fmt.format(forecast)
  return w, f, weather, forecast
Exemplo n.º 4
0
def get_forecast(f):
  f = wa.get_forecast(f)
  fmt = '{}\n\nWeather information provided by openweathermap.org'
  return fmt.format(f)