From 875a7c2555c4dce6c6a91c1d1334cfbda2b237dd Mon Sep 17 00:00:00 2001 From: Gnarflord Date: Sat, 20 Jun 2020 20:44:09 +0200 Subject: [PATCH 1/2] yesss --- weather/weather.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100755 weather/weather.py diff --git a/weather/weather.py b/weather/weather.py new file mode 100755 index 0000000..5ae2cb8 --- /dev/null +++ b/weather/weather.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python +import pyowm +import os + +API_key = "229c25e22cfd9c434134d5c88a1ae588" +owm = pyowm.OWM(API_key, language='de') + +owm.is_API_online() +observation = owm.weather_at_place("Gerbrunn,de") +w = observation.get_weather() + +with open("/tmp/weather.txt", "w") as weather_file: + weather_file.write( + "{} {}°C; {}%h, Wind: {}m/s, {}°C - {}°C\n".format( + w.get_detailed_status(), + w.get_temperature(unit="celsius")["temp"], + w.get_humidity(), + w.get_wind()["speed"], + w.get_temperature(unit="celsius")["temp_min"], + w.get_temperature(unit="celsius")["temp_max"])) + + weather_file.close() From b86fc4f59eaae39cef850466825eb86cad96fa07 Mon Sep 17 00:00:00 2001 From: Pablo Klaschka Date: Tue, 4 Aug 2020 18:03:55 +0200 Subject: [PATCH 2/2] Update weather/weather.py Co-authored-by: Ludwig Richter --- weather/weather.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/weather/weather.py b/weather/weather.py index 5ae2cb8..77e4c26 100755 --- a/weather/weather.py +++ b/weather/weather.py @@ -2,7 +2,9 @@ import pyowm import os -API_key = "229c25e22cfd9c434134d5c88a1ae588" +API_key = "" # insert your API key +if not key: + print("No API key specified") owm = pyowm.OWM(API_key, language='de') owm.is_API_online()