From dc22d01b6ea235173d605f9284ccc008f2fcc9ac Mon Sep 17 00:00:00 2001 From: Daniel STAN Date: Sun, 22 Nov 2015 17:47:14 +0100 Subject: [PATCH] =?UTF-8?q?d=C3=A9-tabification?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client.py | 22 +++++++++++----------- daemon.py | 18 +++++++++--------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/client.py b/client.py index 681f7a4..842cf0f 100644 --- a/client.py +++ b/client.py @@ -54,20 +54,20 @@ class Ticket(object): chambre = u'EXT' try: - deb_adh = crans_utils.datetime_from_generalized_time_format(facture['debutAdhesion'][0].value) - deb_adh = deb_adh.strftime('%d/%m/%Y') + deb_adh = crans_utils.datetime_from_generalized_time_format(facture['debutAdhesion'][0].value) + deb_adh = deb_adh.strftime('%d/%m/%Y') except: - deb_adh=False - try: - fin_adh = crans_utils.datetime_from_generalized_time_format(facture['finAdhesion'][0].value) - fin_adh = fin_adh.strftime('%d/%m/%Y') + deb_adh=False + try: + fin_adh = crans_utils.datetime_from_generalized_time_format(facture['finAdhesion'][0].value) + fin_adh = fin_adh.strftime('%d/%m/%Y') except: - fin_adh=False - try: - fin_co = crans_utils.datetime_from_generalized_time_format(facture['finConnexion'][0].value) + fin_adh=False + try: + fin_co = crans_utils.datetime_from_generalized_time_format(facture['finConnexion'][0].value) fin_co = fin_co.strftime('%d/%m/%Y') - except: - fin_co=False + except: + fin_co=False todo = { 'fid' : facture['fid'][0].value, 'article' : [ art.value for art in facture['article']], diff --git a/daemon.py b/daemon.py index e95bbe6..a0ec420 100755 --- a/daemon.py +++ b/daemon.py @@ -10,16 +10,16 @@ import dump import config def run(): - conn = pika.BlockingConnection(config.PARAMS) - ch = conn.channel() - ch.queue_declare(queue=config.QUEUE) - def callback(ch, method, properties, body): - print (" [x] Received %r" % (body,)) - dump.print_liste(json.loads(body)) + conn = pika.BlockingConnection(config.PARAMS) + ch = conn.channel() + ch.queue_declare(queue=config.QUEUE) + def callback(ch, method, properties, body): + print (" [x] Received %r" % (body,)) + dump.print_liste(json.loads(body)) - ch.basic_consume(callback, queue=config.QUEUE, no_ack=True) - ch.start_consuming() - conn.close() + ch.basic_consume(callback, queue=config.QUEUE, no_ack=True) + ch.start_consuming() + conn.close() # fork en arrière plan + pidfile