-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathutils.py
53 lines (33 loc) · 1.33 KB
/
utils.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import time
import datetime as dt
def getTemp(weather_data):
return weather_data["list"][0]['main']['temp']
def getDescription(weather_data):
return weather_data["list"][0]['weather'][0]['description']
def getIcon(weather_data):
return weather_data["list"][0]['weather'][0]['icon']
def getIconLink(weather_data, size=2):
iconData = weather_data["list"][0]['weather'][0]['icon']
iconLink = f"http://openweathermap.org/img/wn/{iconData}@{size}x.png"
return iconLink
def getWeather(weather_data):
return weather_data["list"][0]['weather'][0]['main']
def getWindDegrees(weather_data):
return weather_data["list"][0]['wind']['deg']
class util:
class time:
def __init__(self, timeObject):
self.timeObject = timeObject.datetime.now()
def hours(self):
return self.timeObject.strftime('%H')
def minutes(self):
return self.timeObject.strftime('%M')
def seconds(self):
return self.timeObject.strftime('%S')
def getSet(self):
h = self.hours()
m = self.minutes()
return str(f'{h} : {m}')
def ui(self):
return self
# https://api.openweathermap.org/data/2.5/forecast?q=Salzburg,5020&appid=5345258a13b1617455dc98c171bf0393