From e752abb6ffde566d0527ad46043fd6c9460d739a Mon Sep 17 00:00:00 2001 From: Vincent Le Gallic Date: Mon, 8 Apr 2013 03:24:31 +0200 Subject: [PATCH] =?utf8?q?abstraction=20des=20diff=C3=A9rents=20FETCHS=20d?= =?utf8?q?ans=20un=20dico?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- today-server.py => today_server.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) rename today-server.py => today_server.py (94%) diff --git a/today-server.py b/today_server.py similarity index 94% rename from today-server.py rename to today_server.py index 4938500..209dd04 100755 --- a/today-server.py +++ b/today_server.py @@ -58,11 +58,15 @@ def update_file(news): json.dump(news, f) f.close() +FETCHS = { + "xkcd" : last_xkcd, + "dtc" : last_dtc, + } def fetch_all(): """Va chercher sur les différents sites les nouveaux trucs.""" news = {} - news["xkcd"] = last_xkcd() - news["dtc"] = last_dtc() + for (k, f) in FETCHS.iteritems(): + news[k] = f() return news def sync(): -- 2.39.2