wetterinfo angefügt
This commit is contained in:
1 parent
ed7fd71368
commit
a5b9e96ebd
5 files changed
+119
-5
No files matched your search
@@ -0,0 +1,25 @@
|
||||
# import the module
|
||||
import python_weather
|
||||
import os
|
||||
|
||||
def getweather():
|
||||
# declare the client. format defaults to the metric system (celcius, km/h, etc.)
|
||||
with python_weather.Client(format=python_weather.METRIC) as client:
|
||||
|
||||
# fetch a weather forecast from a city
|
||||
weather = client.get("Flammersfeld,DE")
|
||||
|
||||
# returns the current day's forecast temperature (int)
|
||||
print("Temp in FFeld: " + weather.current.temperature)
|
||||
|
||||
# get the weather forecast for a few days
|
||||
for forecast in weather.forecasts:
|
||||
print(forecast)
|
||||
|
||||
# hourly forecasts
|
||||
for hourly in forecast.hourly:
|
||||
print(f' --> {hourly!r}')
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
getweather()
|
||||
Reference in new issue
Block a user