summaryrefslogtreecommitdiff
path: root/geshem.py
diff options
context:
space:
mode:
authorYuval Adam <yuval@y3xz.com>2016-01-01 00:08:20 +0200
committerYuval Adam <yuval@y3xz.com>2016-01-01 00:08:20 +0200
commit85133c0488fdedb8616ffca73b7118ea5177f9e0 (patch)
tree8103e82ccee5c8c0dceb95f0c09d7a50d6bd4b47 /geshem.py
parent9bc622faf49397aac757f3e94f183325bdc1acfe (diff)
Initial react and webpack flow
Diffstat (limited to 'geshem.py')
-rw-r--r--geshem.py13
1 files changed, 3 insertions, 10 deletions
diff --git a/geshem.py b/geshem.py
index eaf1060..511802f 100644
--- a/geshem.py
+++ b/geshem.py
@@ -24,7 +24,7 @@ def fetch_latest_images(local=False):
if redis.get('processed:{}'.format(ts)):
continue
else:
- redis.set('processed:{}'.format(ts))
+ redis.set('processed:{}'.format(ts), '1')
dt = datetime.strptime(ts, '%Y:%m:%d:%H:%M').strftime('%Y%m%d_%H%M%S')
image = requests.get('http://' + url)
if not local:
@@ -32,19 +32,12 @@ def fetch_latest_images(local=False):
else:
dt = 'dev'
filename = '{}_{}.png'.format(dt, res)
- with open(str(STATIC_DIR / filename), 'wb+') as f:
+ with open(str(STATIC_DIR / 'img' / filename), 'wb+') as f:
f.write(image.content)
@app.route('/')
def home():
- try:
- latests = redis.pipeline().get('latest_140').get('latest_280').execute()
- latest_140, latest_280 = map(lambda x: x.decode(), latests)
- 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()
- return render_template('index.html', ts=ts, latest_140=latest_140, latest_280=latest_280)
+ return render_template('index.html')
@app.after_request
def update_images(response):