Example #1
0
def update_local_from_WW():
    # as of now this doesn't remove ones that have been flag as no longer delivering
    # even though they have been deleted from WW
    print "Getting orders from WW...",
    # Get order list from WW
    response = ww.get_orders()
    print "Done"

    # Check Error Codes
    if (response.status_code != 200):
        return False

    # Get actual order data
    orders = response.json()['orders']

    # Get Local DB
    local = mTools.LocalDB()

    print "Cycling through orders...",
    for order in orders:
        ww_order = orders[order]
       	if 'walden_ID' in ww_order['delivery']['customFields']:
	    walden_ID = ww_order['delivery']['customFields']['walden_ID']
            local.set_ww_ID(walden_ID, ww_order['id'])
    print "Done"

    local.disconnect()
    return True
Example #2
0
def update_local_from_WW():
    # as of now this doesn't remove ones that have been flag as no longer delivering
    # even though they have been deleted from WW
    print "Getting orders from WW...",
    # Get order list from WW
    response = ww.get_orders()
    print "Done"

    # Check Error Codes
    if (response.status_code != 200):
        return False

    # Get actual order data
    orders = response.json()['orders']

    # Get Local DB
    local = mTools.LocalDB()

    print "Cycling through orders...",
    for order in orders:
        ww_order = orders[order]
        if 'walden_ID' in ww_order['delivery']['customFields']:
            walden_ID = ww_order['delivery']['customFields']['walden_ID']
            local.set_ww_ID(walden_ID, ww_order['id'])
    print "Done"

    local.disconnect()
    return True
Example #3
0
def init_local_from_WW():
    print "Getting Orders from WW...",
    # Get order list from WW
    response = ww.get_orders()
    print "Done"

    # Check Error Codes
    if (response.status_code != 200):
        return False

    # Get actual order data
    orders = response.json()['orders']

    # Get and clear Local DB
    local = mTools.LocalDB()
    local.delete_all_local_documents()

    print "Cycling through orders...",
    for order in orders:
        local.add_from_WW_record(orders[order])
    print "Done"

    local.disconnect()
    return True
Example #4
0
def init_local_from_WW():
    print "Getting Orders from WW...",
    # Get order list from WW
    response = ww.get_orders()
    print "Done"

    # Check Error Codes
    if (response.status_code != 200):
        return False

    # Get actual order data
    orders = response.json()['orders']

    # Get and clear Local DB
    local = mTools.LocalDB()
    local.delete_all_local_documents()

    print "Cycling through orders...",
    for order in orders:
        local.add_from_WW_record(orders[order])
    print "Done"

    local.disconnect()
    return True