From db76c5c74fa43337ed24fd1a6ffca3bf7ab828cc Mon Sep 17 00:00:00 2001 From: Celia Oakley Date: Fri, 1 Jan 2016 21:50:46 +1100 Subject: [PATCH] Add method to access timezone and update README --- README.rst | 2 +- forecastio/models.py | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/README.rst b/README.rst index 67a7c4d..216b78e 100644 --- a/README.rst +++ b/README.rst @@ -167,7 +167,7 @@ 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. -Returned times eg the time parameter on the currently DataPoint are always in UTC time even if making a request with a timezone. If you want to manually convert to the locations local time, you can use the `offset` and `timezone` attributes of the forecast object. +Returned times eg the time parameter on the currently DataPoint are always in UTC time even if making a request with a timezone. If you want to manually convert to the locations local time, you can use the `timezone` and `offset` methods of the forecast object. Typically, would would want to do something like this: diff --git a/forecastio/models.py b/forecastio/models.py index ff89d4d..314e980 100644 --- a/forecastio/models.py +++ b/forecastio/models.py @@ -31,6 +31,9 @@ def hourly(self): def daily(self): return self._forcastio_data('daily') + def timezone(self): + return self.json['timezone'] + def offset(self): return self.json['offset']