def getCsvProdsToFix(): filenames = gui.csvList prodstofix = [] for file in filenames: filepath = gui.getFilePath(file) if (filepath): prodstofix.extend(CsvUtil.getColumn(filepath, "id")) return prodstofix
import CsvUtil as cu import requests import datetime domain = '' token = '' csvfile = '.csv' delay= 0.5 api = VendApi(domain, token) products = api.getProducts() skus = cu.getColumn(csvfile, 'sku') handles = cu.getColumn(csvfile, 'handle') links = cu.getColumn(csvfile, 'image_url') failedskus = ['sku'] failedhandles = ['handle'] failedlinks = ['image_url'] def getSkuHandleToProdId(products): skuhandlemap = {} for p in products: sku = p['sku'] handle = p['handle'] pid = p['id']
import CsvUtil as cu import time import JsonUtil as ju import datetime as dt import sys, getopt customercsv = '.csv' emailtocodeLookup = {} code_to_keep = ['merging_customer_code'] code_to_delete = ['deleting_customer_code'] emails = cu.getColumn(customercsv, "email") cust_codes = cu.getColumn(customercsv, "customer_code") i = 0 while i < len(emails): curr_email = emails[i].lower() curr_code = cust_codes[i] lookupcode = emailtocodeLookup.get(curr_email) if lookupcode is None: emailtocodeLookup[curr_email] = curr_code i += 1 continue
if __name__ == '__main__': testjson = ju.loadJsonFile('test.json') testfiles = testjson['testfiles'] denominations = testjson['denominations'] results = [] for denomination in denominations: results.append([str(denomination)]) for testfile in testfiles: print(f"Running {testfile} : {denomination}...") totals = cu.getColumn(testfile, 'sale_total') paids = cu.getColumn(testfile, 'amount') newAlgo3 = runTest(qca.getQuickCash, totals, paids, numSuggestions=3, sortedDenom=denomination) newAlgo2 = runTest(qca.getQuickCash, totals, paids, numSuggestions=2, sortedDenom=denomination) oldAlgo = runTest(qca.getQuickCashOld, totals, paids,
import CsvUtil as cu from VendApi import * import time import JsonUtil as ju import datetime as dt import sys, getopt prefix = '' token = '' mergecsv = '.csv' deletecusts = cu.getColumn(mergecsv, "deleting_customer_code") mergingcusts = cu.getColumn(mergecsv, "merging_customer_code") delay = .8 api = VendApi(prefix, token) print(f"Retrieving customers for {prefix}.vendhq.com...") customers = api.getCustomers() custToId = {} failed_ids = ['customer_id'] failed_sales = ['sale'] failed_codes = ['status_code'] failed_response = ['response'] registers = api.getRegisters('true') regidlookup = {}
domain = '' token = '' csvfile = 'all' delay = 0.7 api = VendApi(domain, token) products = api.getProducts() prodidtoobj = api.getKeyToObjs(products, 'id') prodtoprocess = [] prodids = [] if csvfile != 'all': prodids = cu.getColumn(csvfile, 'id') for pid in prodids: prodobj = prodidtoobj.get(pid) if prodobj is None: print(f"{pid} not found in lookup...") continue prodtoprocess.append(prodobj) else: prodtoprocess = products # get the prod objects print(f'Found {len(prodtoprocess)} products to process...')
import CsvUtil as cu from VendApi import * import time import JsonUtil as ju import datetime as dt prefix = '' token = '' csvFile = '.csv' column = 'id' consignments = cu.getColumn(csvFile, column) api = VendApi(prefix, token) errored = [] errored_response = [] def getConsignmentProducts(id): result = api.getConsigmentProducts(id) #print(result) return result def reversion(getObj): return api.reversionConsigmentProducts(getObj) def reversionsProducts(cons_prods, results, errored): for cp in cons_prods: #print(cp)