diff --git a/User-contributed-modules.md b/User-contributed-modules.md index ecf82f9..33a5890 100644 --- a/User-contributed-modules.md +++ b/User-contributed-modules.md @@ -146,15 +146,17 @@ For Gmail, you must allow less secure apps (https://myaccount.google.com/securit import urllib.request, json -city = "Kiev" -api_key = "your api key" +city = "Insert Your City" +api_key = "Insert Your API Key" +units = "Insert your units (Default: Kelvin, Options: Metric, Imperial" +unit_key = "Insert your Unit Key(K, C, F)" -weather = eval(str(urllib.request.urlopen("http://api.openweathermap.org/data/2.5/weather?q={}&APPID={}".format(city, api_key)).read())[2:-1]) +weather = eval(str(urllib.request.urlopen("http://api.openweathermap.org/data/2.5/weather?q={}&APPID={}&units={}".format(city, api_key, units)).read())[2:-1]) info = weather["weather"][0]["description"].capitalize() -temp = int(float(weather["main"]["temp"]) - 272.15) +temp = int(float(weather["main"]["temp"])) -print("%s, %i °C" % (info, temp)) +print("%s, %i °%s" % (info, temp, unit_key)) ``` ## Module