Esempio n. 1
0
def callWhenWillItRain(lat, lon, units='m'):
  url, params = when_will_it_rain.request_options(lat, lon)
  headers = request_headers()
  r = requests.get(url, params=params, headers=headers)
  if r.status_code == 200:
    return when_will_it_rain.handle_response(r.json())
  else:
    handleFail(r)
Esempio n. 2
0
def callSevereWeatherPowerDisruption(lat, lon):
  url, params = power_disruption.request_options(lat, lon)
  headers =request_headers()

  r = requests.get(url, params=params, headers=headers)
  if r.status_code == 200:
    power_disruption.handle_response(r.json())
  else:
    handleFail(r)
Esempio n. 3
0
def callDailyForecast(lat, lon, units = 'm'):
  url, params = daily_forecast.request_options(lat, lon)
  headers = request_headers()

  r = requests.get(url, params=params, headers=headers)
  if r.status_code == 200:
    daily_forecast.handle_response(r.json())
  else:
    handleFail(r)
Esempio n. 4
0
def callTropicalForecastProjectedPath(basin='AL', units='m', nautical=True, source='all'):
  url, params = tropical_forecast.request_options(basin, units, nautical, source)
  headers = request_headers()

  r = requests.get(url, params=params, headers=headers)
  if r.status_code == 200:
    tropical_forecast.handle_response(r.json())
  else:
    handleFail(r)
Esempio n. 5
0
def callWeatherAlertDetails(detailKey):
  url, params = alert_details.request_options(detailKey)
  headers = request_headers()

  r = requests.get(url, params=params, headers=headers)
  if r.status_code == 200:
    alert_details.handle_response(r.json())
  else:
    handleFail(r)
Esempio n. 6
0
def callWeatherAlertHeadlines(lat, lon):
  url, params = alert_headlines.request_options(lat, lon)
  headers = request_headers()

  r = requests.get(url, params=params, headers=headers)
  if r.status_code == 200:
    detailKeys = alert_headlines.handle_response(r.json())
    if detailKeys and len(detailKeys) > 0:
      for detailKey in detailKeys:
        print('Detail key: '+detailKey)
        callWeatherAlertDetails(detailKey)
  else:
    handleFail(r)