From 638e5b3e78dbcf4cd23f2b79aa359ded24eef31e Mon Sep 17 00:00:00 2001 From: cloneofghosts Date: Sat, 15 Nov 2025 14:53:57 -0500 Subject: [PATCH 1/3] Add missing flags and document flags --- README.md | 32 ++++++++++++++++++++++++++++++++ pirateweather/models.py | 2 ++ tests/test_pirateweather.py | 2 ++ 3 files changed, 36 insertions(+) diff --git a/README.md b/README.md index 6e30dd9..f3edead 100644 --- a/README.md +++ b/README.md @@ -112,6 +112,8 @@ The **Forecast** object, it contains both weather data and the HTTP response fro - Returns a PirateWeatherDataBlock object - **daily()** - Returns a PirateWeatherDataBlock object +- **flags()** + - Returns a PirateWeatherFlagsBlock object - **update()** - Refreshes the forecast data by making a new request. @@ -158,6 +160,36 @@ For a full list of PirateWeatherDataPoint attributes and attribute descriptions, ---------------------------------------------------- +*class* pirateweather.models.FlagsDataBlock +--------------------------------------------- + +Contains data about the flags used to generate the forecast. + +**Attributes** *(descriptions taken from the pirateweather.net website)* +- **units** + - Indicates which units were used in the forecasts. +- **version** + - The version of Pirate Weather used to generate the forecast. +- **nearestStation** + - Not implemented, and will always return 0. +- **sources** + - The models used to generate the forecast. +- **sourceTimes** + - The time in UTC when the model was last updated. +- **processTime** + - The time taken to process the request in milliseconds. +- **ingestVersion** + - The ingest version of Pirate Weather used to generate the forecast. +- **nearestCity** + - The name of the closest city to your location. +- **nearestCountry** + - The country name of the closest city to your location. +- **nearestSubNational** + - The sub national name of the closest city to your location. + +---------------------------------------------------- + + How Timezones Work ------------------ Requests with a naive datetime (no time zone specified) will correspond to the supplied time in the requesting location. If a timezone aware datetime object is supplied, the supplied time will be in the associated timezone. diff --git a/pirateweather/models.py b/pirateweather/models.py index 77f580f..83e109b 100644 --- a/pirateweather/models.py +++ b/pirateweather/models.py @@ -111,6 +111,8 @@ def __init__(self, d=None): self.processTime = d.get("processTime") self.ingestVersion = d.get("ingestVersion") self.nearestCity = d.get("nearestCity") + self.nearestCountry = d.get("nearestCountry") + self.nearestSubNational = d.get("nearestSubNational") def __unicode__(self): """Return a string representation of the data block.""" diff --git a/tests/test_pirateweather.py b/tests/test_pirateweather.py index bb8ec7e..f88c157 100644 --- a/tests/test_pirateweather.py +++ b/tests/test_pirateweather.py @@ -112,6 +112,8 @@ def test_flags(self): assert flags.processTime assert flags.ingestVersion assert flags.nearestCity == "Amsterdam" + assert flags.nearestCountry == "Netherlands" + assert flags.nearestSubNational == "North Holland" def test_invalid_key(self): """Test querying the API endpoint with a invalid API key.""" From a135445ba40b1080d8bf9e604efa7bb3fdcdec1a Mon Sep 17 00:00:00 2001 From: cloneofghosts Date: Sat, 15 Nov 2025 14:55:42 -0500 Subject: [PATCH 2/3] Increment version --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index b79f715..3118c1b 100644 --- a/setup.py +++ b/setup.py @@ -20,7 +20,7 @@ def read(fname): setup( name="python-pirateweather", - version="1.2.0", + version="1.2.1", author="cloneofghosts", description=("A thin Python Wrapper for the Pirate Weather API"), license="BSD 2-clause", From fd3328fecee2257df9d4db02555a8090c300c932 Mon Sep 17 00:00:00 2001 From: Kev Date: Sat, 15 Nov 2025 14:57:11 -0500 Subject: [PATCH 3/3] Update README.md Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f3edead..7c293ea 100644 --- a/README.md +++ b/README.md @@ -160,8 +160,8 @@ For a full list of PirateWeatherDataPoint attributes and attribute descriptions, ---------------------------------------------------- -*class* pirateweather.models.FlagsDataBlock ---------------------------------------------- +*class* pirateweather.models.PirateWeatherFlagsBlock +--------------------------------------------------- Contains data about the flags used to generate the forecast.