def really_process_data(txn, data): ''' We are called with a hard coded AFOS PIL ''' tp = TextProduct(data) if tp.afos is None: compute_afos(tp) utc = tp.valid table = "products_%s_0106" % (utc.year,) if utc.month > 6: table = "products_%s_0712" % (utc.year,) sql = """INSERT into """ + table + """ (pil, data, source, wmo, entered) values(%s,%s,%s,%s,%s)""" sqlargs = (tp.afos, tp.text, tp.source, tp.wmo, utc.strftime("%Y-%m-%d %H:%M+00")) txn.execute(sql, sqlargs) if tp.afos[:3] == 'FRH': return jmsgs = tp.get_jabbers( common.SETTINGS.get('pywwa_product_url', 'pywwa_product_url')) for jmsg in jmsgs: JABBER.send_message(*jmsg)
def really_process_data(txn, data): """ We are called with a hard coded AFOS PIL """ tp = TextProduct(data) if tp.afos is None: compute_afos(tp) sql = ("INSERT into products " "(pil, data, source, wmo, entered) values(%s,%s,%s,%s,%s)") sqlargs = ( tp.afos, tp.text, tp.source, tp.wmo, tp.valid.strftime("%Y-%m-%d %H:%M+00"), ) txn.execute(sql, sqlargs) if tp.afos[:3] == "FRH": return jmsgs = tp.get_jabbers( common.SETTINGS.get("pywwa_product_url", "pywwa_product_url")) for jmsg in jmsgs: JABBER.send_message(*jmsg)