Example #1
0
def form_input():
    airportName = request.form["airportName"]
    latLongArray = getAirportCoordinates(airportName)
    if latLongArray == "error":
        return render_template(
            "user_input.html",
            errorMessage="Error wrong airport name. It must be exact name!")
    result = weatherInformation(latLongArray[0], latLongArray[1])
    print(result)
    weather = result['weather'][0]['main']
    temp = result['main']['temp']
    feels_like = result['main']['feels_like']
    temp_max = result['main']['temp_max']
    temp_min = result['main']['temp_min']
    humidity = result['main']['humidity']
    return render_template("weather_output.html",
                           weather=weather,
                           temp=temp,
                           feels_like=feels_like,
                           temp_max=temp_max,
                           temp_min=temp_min,
                           humidity=humidity,
                           airportName=airportName)
Example #2
0
def test_airportErrorCheck3():
    assert getAirportCoordinates("hello") == "error"
Example #3
0
def test_airportCheck1():
    assert getAirportCoordinates("Total Rf Heliport") == [
        '40.07080078', '-74.93360138'
    ]
Example #4
0
def test_airportErrorCheck2():
    assert getAirportCoordinates("SF") == "error"
Example #5
0
def test_airportErrorCheck1():
    assert getAirportCoordinates("Boston") == "error"
Example #6
0
def test_airportCheck4():
    assert getAirportCoordinates("Frazier Lake Airpark") == [
        '36.95330048', '-121.4649963'
    ]
Example #7
0
def test_airportCheck3():
    assert getAirportCoordinates("Williams Ag Airport") == [
        '39.427188', '-121.763427'
    ]
Example #8
0
def test_airportCheck2():
    assert getAirportCoordinates("Lowell Field") == [
        '59.94919968', '-151.6959991'
    ]