Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 32 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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.
Expand Down
2 changes: 2 additions & 0 deletions pirateweather/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 2 additions & 0 deletions tests/test_pirateweather.py
Original file line number Diff line number Diff line change
Expand Up @@ -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."""
Expand Down
Loading