diff --git a/README.md b/README.md index 6e30dd9..7c293ea 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.PirateWeatherFlagsBlock +--------------------------------------------------- + +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/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", 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."""