Exemplo n.º 1
0
def update_delivery_json(json_string):
    db = DB()
    list_delivery = json.loads(json_string)
    for data in list_delivery:
        checkcache = Caching()
        s = checkcache.get(str(data['Id']))
        if s is None:
            checkcache.set(str(data['Id']), data['subscriber'])
            cursor = db.query('''UPDATE outbound
                      SET status = %s, description = %s, updated_at = %s
                      WHERE (transactionid = %s)''', (Delivery(data['status']), FindDescription(data['status']), datetime.datetime.now(),data['Id']))
            WriteToFile.delay(data['Id'], cursor)