Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: dgomes/pyipma
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 3.0.8
Choose a base ref
...
head repository: dgomes/pyipma
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 3 commits
  • 4 files changed
  • 1 contributor

Commits on Dec 26, 2024

  1. Update README.md

    dgomes authored Dec 26, 2024
    Copy the full SHA
    0cefed3 View commit details

Commits on Feb 10, 2025

  1. adjust forecast interval

    dgomes committed Feb 10, 2025
    Copy the full SHA
    9723852 View commit details
  2. release bump

    dgomes committed Feb 10, 2025
    Copy the full SHA
    421dbcf View commit details
Showing with 21 additions and 3 deletions.
  1. +2 −0 README.md
  2. +6 −0 example.py
  3. +1 −1 pyipma/__init__.py
  4. +12 −2 pyipma/forecast.py
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -39,6 +39,8 @@ asyncio.get_event_loop().run_until_complete(main())

## Changelog

* 3.0.9 - Adjust forecast window for 24 hours periods
* 3.0.8 - Adds Weather Warnings
* 3.0.7 - Adds UV Index (@tokenize74)
* 3.0.6 - Bug Fixes
* 3.0.3 - Adds RCM (Fire Risk)
6 changes: 6 additions & 0 deletions example.py
Original file line number Diff line number Diff line change
@@ -30,6 +30,12 @@ async def main():
print("Current Weather based on forecast data for the next hour: {}".format(forecasts[0]))
print("UTCI if available: ", forecasts[0].utci)


forecasts = await location.forecast(api, 24)
print("Current Weather based on forecast data for the next days: {}".format(forecasts[0]))
print("UTCI if available: ", forecasts[0].utci)


sea_forecasts = await location.sea_forecast(api)
print("Sea forecast for today {}".format(sea_forecasts[0]))

2 changes: 1 addition & 1 deletion pyipma/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""Python library for http://api.ipma.pt."""
__version__ = "3.0.8"
__version__ = "3.0.9"

class IPMAException(Exception):
pass
14 changes: 12 additions & 2 deletions pyipma/forecast.py
Original file line number Diff line number Diff line change
@@ -176,8 +176,18 @@ async def get(self, globalIdLocal, period: int = 24):
)
for r in raw
if r["idPeriodo"] == period
and datetime.datetime.strptime(r["dataPrev"], "%Y-%m-%dT%H:%M:%S")
> (datetime.datetime.now() - timedelta(hours=1))
and (
(
datetime.datetime.strptime(r["dataPrev"], "%Y-%m-%dT%H:%M:%S")
> (datetime.datetime.now() - timedelta(hours=1))
and period in (1, 3)
)
or (
datetime.datetime.strptime(r["dataPrev"], "%Y-%m-%dT%H:%M:%S")
> (datetime.datetime.now() - timedelta(days=1))
and period == 24
)
)
],
key=lambda d: d.dataPrev,
)