コード例 #1
0
ファイル: views.py プロジェクト: necaris/isitrainingnow.com
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")
コード例 #2
0
ファイル: mirrorapp.py プロジェクト: genericmoniker/mirror
def current_weather():
    return jsonify(weather.current_conditions(app.config))
コード例 #3
0
 def test_current(self):
     result = weather.current_conditions("04730", "imperial")
     self.assertEquals(len(result), 1)
     self.assertEquals(len(result['descriptions']), 2)