generated from mwc/lab_weather
having trouble with location
still having trouble with location, the rest seems to be working
This commit is contained in:
parent
47b8a5b675
commit
67252a5aca
|
@ -25,16 +25,23 @@ def print_weather(location=None, metric=False, verbose=False):
|
|||
coordinates = estimate_location()
|
||||
else:
|
||||
coordinates = geocode_location(location)
|
||||
print(coordinates)
|
||||
#if coordinates == None:
|
||||
# print("Location Unknown, Try Again")
|
||||
|
||||
|
||||
|
||||
office_info = get_weather_office(coordinates["lat"], coordinates["lng"])
|
||||
office_only = office_info["office"]
|
||||
|
||||
all_forecasts = get_forecast(office_info["office"], office_info["x"], office_info["y"])
|
||||
print(all_forecasts)
|
||||
print()
|
||||
all_forecasts = get_forecast(office_info["office"], office_info["x"], office_info["y"], metric)
|
||||
print("The forecast for", office_only, "is")
|
||||
for forecast in all_forecasts:
|
||||
print(forecast["name"],"temperature of", forecast["temperature"], "wind speed of", forecast["wind_speed"], "out of the ", forecast["wind_direction"],"conditions of", forecast["description"]) # YOUR CODE HERE!
|
||||
if verbose==False:
|
||||
simple_forecast = all_forecasts[0]
|
||||
print(simple_forecast["name"],"temperature of", simple_forecast["temperature"], "wind speed of", simple_forecast["wind_speed"], "out of the ", simple_forecast["wind_direction"],"conditions of", simple_forecast["description"])
|
||||
print()
|
||||
else:
|
||||
for forecast in all_forecasts:
|
||||
print(forecast["name"],"temperature of", forecast["temperature"], "wind speed of", forecast["wind_speed"], "out of the ", forecast["wind_direction"],"conditions of", forecast["description"])
|
||||
print()
|
||||
|
||||
print_weather()
|
||||
|
|
Loading…
Reference in New Issue