Ejemplo n.º 1
0
def test_weather():
    class loc(object):
        pass
    loc.lat = '37.7833'
    loc.lng = '-122.4167'
    response = external._lookup_weather(loc)
    name = response['city']['name']
    assert(name == "San Francisco") # test_weather 1

    loc.lat = '40.7127'
    loc.lng = '-74.0059'
    response = external._lookup_weather(loc)
    name = response['city']['name']
    assert(name == "New York") # test_weather 2
Ejemplo n.º 2
0
def weather_json():
    lat = request.args.get('lat')
    lon = request.args.get('lon')
    location = Location(lat,lon)

    result = external._lookup_weather(location)
    return jsonify({'weather-json': result})
Ejemplo n.º 3
0
    def get_weather_json(self):
        if self._weather_json is None:
            self._weather_json = external._lookup_weather(self.location)

        return self._weather_json