diff --git a/sopel_modules/weather/providers/weather/darksky.py b/sopel_modules/weather/providers/weather/darksky.py index a75a76d..2bd95f3 100755 --- a/sopel_modules/weather/providers/weather/darksky.py +++ b/sopel_modules/weather/providers/weather/darksky.py @@ -15,7 +15,10 @@ def darksky_forecast(bot, latitude, longitude, location): 'exclude': 'currently,minutely,hourly,alerts,flags', # Exclude extra data we don't want/need 'units': 'si' } - r = requests.get(url, params=params) + try: + r = requests.get(url, params=params) + except: + raise Exception("An Error Occurred. Check Logs For More Information.") data = r.json() if r.status_code != 200: raise Exception('Error: {}'.format(data['error'])) @@ -42,7 +45,10 @@ def darksky_weather(bot, latitude, longitude, location): 'exclude': 'minutely,hourly,daily,alerts,flags', # Exclude extra data we don't want/need 'units': 'si' } - r = requests.get(url, params=params) + try: + r = requests.get(url, params=params) + except: + raise Exception("An Error Occurred. Check Logs For More Information.") data = r.json() if r.status_code != 200: raise Exception('Error: {}'.format(data['error'])) diff --git a/sopel_modules/weather/providers/weather/openweathermap.py b/sopel_modules/weather/providers/weather/openweathermap.py index 44e2afa..a4a42d6 100755 --- a/sopel_modules/weather/providers/weather/openweathermap.py +++ b/sopel_modules/weather/providers/weather/openweathermap.py @@ -15,7 +15,10 @@ def openweathermap_forecast(bot, latitude, longitude, location): 'exclude': 'current,minutely,hourly', 'units': 'metric' } - r = requests.get(url, params=params) + try: + r = requests.get(url, params=params) + except: + raise Exception("An Error Occurred. Check Logs For More Information.") data = r.json() if r.status_code != 200: raise Exception('Error: {}'.format(data['message'])) @@ -42,7 +45,10 @@ def openweathermap_weather(bot, latitude, longitude, location): 'exclude': 'minutely,hourly,daily', 'units': 'metric' } - r = requests.get(url, params=params) + try: + r = requests.get(url, params=params) + except: + raise Exception("An Error Occurred. Check Logs For More Information.") data = r.json() if r.status_code != 200: raise Exception('Error: {}'.format(data['message']))