1
1
#!/usr/bin/env python3
2
2
import asyncio
3
+ import sys
4
+ import json
5
+ import datetime as dt
3
6
import lib .weather .weatherbase as base
4
7
from lib .weather .weather_icon import weather_icon_mapping
5
8
from lib .asynclib import make_async
@@ -22,7 +25,7 @@ async def parse_args(self) -> str:
22
25
return await self .url_builder ()
23
26
24
27
25
- async def get_long_and_lat (self , location : str = None , zipcode : int = None ) -> Tuple :
28
+ async def get_long_and_lat (self , location : str = None , zipcode : int = None , url = None ) -> Tuple :
26
29
"""
27
30
Searches for Longitude and latitude for Given City
28
31
"""
@@ -135,10 +138,10 @@ def __repr__(self) -> str:
135
138
@property
136
139
def get_icon (self ):
137
140
# Have to get the icon
138
- condition : int = self ._weather [0 ]['shortForecast' ].lower ()
141
+ condition : str = self ._weather [0 ]['shortForecast' ].lower ()
139
142
if any (s in condition .lower () for s in ("sunny" , "clear" , 'sun' )):
140
143
# Sunny
141
- if self ._sunset > datetime .now ():
144
+ if self ._sunset . replace ( tzinfo = None ) > datetime .now ():
142
145
owm_icon = weather_icon_mapping [0 ]
143
146
else :
144
147
owm_icon = weather_icon_mapping [48 ]
@@ -147,7 +150,7 @@ def get_icon(self):
147
150
elif 'snow' in condition :
148
151
owm_icon = weather_icon_mapping [13 ]
149
152
elif any (s in condition .lower () for s in ('cloudy' , 'cloud' )):
150
- owm_icon = weather_icon_ampping [7 ]
153
+ owm_icon = weather_icon_mapping [7 ]
151
154
else :
152
155
owm_icon = weather_icon_mapping [0 ]
153
156
return owm_icon
0 commit comments