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