From 589211eb96accfa08609aa83e823ed6694f8ad3e Mon Sep 17 00:00:00 2001 From: Florian Bezannier Date: Thu, 24 Dec 2020 10:14:09 +0100 Subject: [PATCH] try new method to update_trips v2 --- requirements.txt | 12 +++++++----- web/callback.py | 2 +- web/db.py | 3 +++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/requirements.txt b/requirements.txt index 98a33b1..da99b12 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,10 +3,6 @@ dash>=1.18.0 plotly>=4 pandas oauth2_client -python-dateutil -certifi -urllib3 -six requests numpy pytz @@ -14,4 +10,10 @@ typing argparse flask dash_bootstrap_components -geojson \ No newline at end of file +geojson + +#swagger req +certifi >= 14.05.14 +six >= 1.10 +python_dateutil >= 2.5.3 +urllib3 >= 1.15.1 \ No newline at end of file diff --git a/web/callback.py b/web/callback.py index e4b384b..4afae47 100644 --- a/web/callback.py +++ b/web/callback.py @@ -115,6 +115,7 @@ def update_trips(): try: + web.db.callback_fct = update_trips update_trips() min_date = trips[0].start_at max_date = trips[-1].start_at @@ -158,4 +159,3 @@ dash_app.layout = dbc.Container(fluid=True, children=[ data_div ]) -web.db.update_callback = update_trips \ No newline at end of file diff --git a/web/db.py b/web/db.py index c09976f..cfb5eaa 100644 --- a/web/db.py +++ b/web/db.py @@ -2,12 +2,15 @@ import sqlite3 from datetime import datetime import pytz +callback_fct = None def convert_datetime(st): return datetime.strptime(st.decode("utf-8"), "%Y-%m-%d %H:%M:%S+00:00").replace(tzinfo=pytz.UTC) def update_callback(): + if callback_fct is not None: + callback_fct() return def get_db():