generated from mwc/lab_weather
some help as I work thorugh weather.py
Submitting for some help on the weather.py file. It is not printing the help for me nor letting me input a location with -h or -l as I mentioned on Discord.
This commit is contained in:
parent
0a4b79f4c2
commit
bd5373efd9
|
@ -8,7 +8,7 @@
|
||||||
#
|
#
|
||||||
# It's your job to implement this function.
|
# It's your job to implement this function.
|
||||||
|
|
||||||
from weather.weather_apis import (
|
from weather_apis import (
|
||||||
geocode_location,
|
geocode_location,
|
||||||
estimate_location,
|
estimate_location,
|
||||||
get_weather_office,
|
get_weather_office,
|
||||||
|
@ -21,4 +21,20 @@ def print_weather(location=None, metric=False, verbose=False):
|
||||||
When metric is True, prints out the weather in metric units.
|
When metric is True, prints out the weather in metric units.
|
||||||
When verbose is True, prints out a more detailed report.
|
When verbose is True, prints out a more detailed report.
|
||||||
"""
|
"""
|
||||||
print("Not finished...") # YOUR CODE HERE!
|
if location == None:
|
||||||
|
coordinates = estimate_location()
|
||||||
|
else:
|
||||||
|
coordinates = geocode_location(location)
|
||||||
|
|
||||||
|
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()
|
||||||
|
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!
|
||||||
|
print()
|
||||||
|
|
||||||
|
print_weather()
|
|
@ -9,7 +9,7 @@
|
||||||
# You don't need to do anything with thie file.
|
# You don't need to do anything with thie file.
|
||||||
|
|
||||||
from argparse import ArgumentParser
|
from argparse import ArgumentParser
|
||||||
from weather.weather import print_weather
|
from weather import print_weather
|
||||||
|
|
||||||
def weather_cli():
|
def weather_cli():
|
||||||
"""Provides a command-line interface for weather.
|
"""Provides a command-line interface for weather.
|
||||||
|
|
Loading…
Reference in New Issue