Skip to content

Commit

Permalink
Merge pull request #19 from Abdur-rahmaanJ/fix/key-not-found
Browse files Browse the repository at this point in the history
Fix/key not found
  • Loading branch information
Abdur-rahmaanJ authored Nov 10, 2023
2 parents 5f908dd + c6a50c9 commit dbb9726
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,8 @@ Run
## 2.8.1

- Feat cache
- 2.8.2 Fix imports
- 2.8.3 Fix key error

## 2.8.0

Expand Down
2 changes: 1 addition & 1 deletion meteomoris/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
get_latest = Meteo.get_latest
get_uvindex = Meteo.get_uvindex

__version__ = "2.8.2"
__version__ = "2.8.3"
21 changes: 16 additions & 5 deletions meteomoris/meteo.py
Original file line number Diff line number Diff line change
Expand Up @@ -886,10 +886,18 @@ def print_today(cls, country='mu'):
moonphase = cls.get_moonphase()['{} {}'.format(month, year)]
except:
skip_moonphase = True
if country == 'mu':
sun = cls.get_sunrisemu()[month][str(day)]
if country == 'mu' :
sunrise = cls.get_sunrisemu()
try:
sun = sunrise[month][str(day)]
except KeyError:
sun = sunrise[month][int(day)]
else:
sun = cls.get_sunriserodr()[month][str(day)]
sunrise = cls.get_sunriserodr()
try:
sun = sunrise[month][str(day)]
except KeyError:
sun = sunrise[month][int(day)]


# cls.print(forecast)
Expand Down Expand Up @@ -1028,7 +1036,10 @@ def print_today(cls, country='mu'):
###

tides_all = cls.get_tides()
tides = tides_all['months'][month][str(day)]
try:
tides = tides_all['months'][month][str(day)]
except KeyError:
tides = tides_all['months'][month][int(day)]
tidetable = Table()

tidetable.add_column("Tide", justify="left", style="slate_blue3", no_wrap=True)
Expand Down Expand Up @@ -1237,7 +1248,7 @@ def get_tides(cls, print=False):
cls.add_to_cache('tides', tide_info)
except Exception as e:
raise e
cls.print(tide_info)
# cls.print(tide_info)
return tide_info


Expand Down

0 comments on commit dbb9726

Please sign in to comment.