diff --git a/core/translator.py b/core/translator.py index a79d644..f194f01 100755 --- a/core/translator.py +++ b/core/translator.py @@ -41,9 +41,6 @@ ch.setFormatter(formatter) logger.addHandler(fh) logger.addHandler(ch) -#conn_send = pika.BlockingConnection(pika.ConnectionParameters(host='localhost',heartbeat_interval=0)) -#conn_receive = pika.BlockingConnection(pika.ConnectionParameters(host='localhost',heartbeat_interval=0)) - manager = PikaManager.PikaManager("150.165.205.10", "test", "test") def run(ch, method, properties, body): @@ -61,20 +58,20 @@ def run(ch, method, properties, body): body : json object Informations received from queue. """ - logger.info("Processando a requisição " + properties.correlation_id.encode("utf-8")) # body it's a json that contains text to be translating body = json.loads(body) - print ("Translating...",) + print ("Translating...") # Initialize the translation of text - logger.info("Traduzindo texto") try: + logger.info("Traduzindo: "+body["text"]+" id: "+properties.correlation_id.encode("utf-8")) gloss = traduzir(body["text"].encode("utf-8")) body["gloss"] = gloss del body["text"] except KeyError: + logger.info("Não existe texto para traduzir") pass # Send the body to the queue - logger.info("Enviando para a fila de traduções") + logger.info("Enviando glosa para a fila de traduções") manager.send_to_queue("translations", body, properties) print ("Success") -- libgit2 0.21.2