Exemplo n.º 1
0
def from_query(request):
    """
    Serve an index page that knows a user's location from their browser,
    with details passed in via query parameters.
    """
    lat = float(request.GET.get("lat", 0.0))
    lon = float(request.GET.get("lon", 0.0))
    conditions = weather.current_conditions(lat, lon)
    raining = weather.is_it_raining_at(lat, lon, conditions)
    return utils.format_result(raining, (lat, lon), conditions, "Location determined from your browser")
Exemplo n.º 2
0
def current_weather():
    return jsonify(weather.current_conditions(app.config))
 def test_current(self):
     result = weather.current_conditions("04730", "imperial")
     self.assertEquals(len(result), 1)
     self.assertEquals(len(result['descriptions']), 2)