def getForecastResponseFromRequest():
    '''
    Method of sending a request to the Dark Sky API, then handling the response by calling on the .json() method to convert the response to a Python Dict object.

    Output:
        1.  data_dict  ::  Python dict object containing key-value pairs for hourly data fetched from api.darksky.net
    '''
    data_dict = api.getForecastDataFromDarkSky('Vancouver Canada')
    data_dict = data_dict.json()

    return data_dict
def getForecastWeatherAlerts(address):
    '''
    Method to fetch forecasted weather alerts.
    This method will accept the a Python dict as Input and print out the alerts as a string.

    Input:
        1.  address  ::  Python Str object specifying the address for where forecast weather alerts is to be fetched for.
    Output:
        2.  Alert Msg  ::  A string object outputing the alerts from the alerts attribute (which is an array of objects - with following attributes:
            - description (string)
            - expires (unix time stamp)
            - regions affected (array)
            - severity (string)
            - time of alert (unix time stamp)
            - title (string)
            - uri (string)
    '''
    darksky_response = api.getForecastDataFromDarkSky(address)
    json_data_dict = darksky_response.json()
    weather_alerts_content = json_data_dict['alerts'][1]
    weather_alert_out = \
'''
***  %s  ***

%s

Regions Affected:
%s

Severity:
%s

Time:
%s

''' % (
    weather_alerts_content['title'],
    weather_alerts_content['description'],
    weather_alerts_content['regions'],
    weather_alerts_content['severity'],
    api.getHumanReadableTimeFromUnixTimeStamp(weather_alerts_content['time'])
    )

    return weather_alert_out
def get_hourly_data():
    # kwkw - WIP - will have to refadtor once MVP website is built up.
    forecast_response = api.getForecastDataFromDarkSky('Vancouver Canada')
    # kwkw - WIP - hourly data returns an array of
    hourly_forecast = dsky.getHourlyForecastData(forecast_response.json())
    return jsonify(hourly_forecast)
def get_daily_data():
    # kwkw - WIP - will have to refactor once full MVP is constructed.
    forecast_response = api.getForecastDataFromDarkSky('Vancouver Canada')
    daily_forecast = dsky.getDailyForecastData(forecast_response.json())
    return jsonify(daily_forecast)
def get_index():
    forecast = api.getForecastDataFromDarkSky('Vancouver Canada')
    # kwkw - returns a python dict
    data = forecast.json()
    return jsonify(data)