summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYuval Adam <yuval@y3xz.com>2015-11-08 13:57:24 +0200
committerYuval Adam <yuval@y3xz.com>2015-11-08 13:57:24 +0200
commit343b05af04557aaaa68a627ad1bd8cd990aa6b4e (patch)
tree88754e572f30683a0f51d7c2944a0cf57c661211
parent740935e8936df84a73f89eb5512355584e10fe11 (diff)
Fix UTC->IL timestamps
-rw-r--r--geshem.py3
-rw-r--r--requirements.txt1
2 files changed, 3 insertions, 1 deletions
diff --git a/geshem.py b/geshem.py
index 67807d1..19eb984 100644
--- a/geshem.py
+++ b/geshem.py
@@ -5,6 +5,7 @@ from datetime import datetime
from flask import Flask, render_template
from os import environ
from pathlib import Path
+from pytz import utc, timezone
from redis.exceptions import ConnectionError
MAPS_JSON = 'http://map.govmap.gov.il/rainradar/radar.json'
@@ -34,7 +35,7 @@ def home():
try:
latests = redis.pipeline().get('latest_140').get('latest_280').execute()
latest_140, latest_280 = map(lambda x: x.decode(), latests)
- ts = datetime.strptime(latest_280, '%Y%m%d_%H%M%S')
+ ts = utc.localize(datetime.strptime(latest_280, '%Y%m%d_%H%M%S')).astimezone(timezone('Asia/Jerusalem'))
except ConnectionError:
latest_140, latest_280 = 'dev', 'dev'
ts = datetime.now()
diff --git a/requirements.txt b/requirements.txt
index a7eacd1..c25b874 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -4,5 +4,6 @@ MarkupSafe==0.23
Werkzeug==0.10.4
gunicorn==19.3.0
itsdangerous==0.24
+pytz==2015.7
redis==2.10.5
requests==2.8.1