def iterate_customers_start(): request = qbxml.customer_request_iterative() session_manager.queue_session({ 'reqXML': request, 'ticket': "", 'callback': iterate_customers_continue, 'updatePauseSeconds': "", 'minimumUpdateSeconds': 60, 'MinimumRunEveryNSeconds': 45 })
def iterate_customers_continue(ticket,responseXML): db.insert_customer(responseXML) root = etree.fromstring(responseXML) # do something with the response, store it in a database, return it somewhere etc requestID = int(root.xpath('//CustomerQueryRs/@requestID')[0]) iteratorRemainingCount = int(root.xpath('//CustomerQueryRs/@iteratorRemainingCount')[0]) iteratorID = root.xpath('//CustomerQueryRs/@iteratorID')[0] print "iteratorID",iteratorID,"iteratorRemainingCount:",iteratorRemainingCount,'requestID',requestID if iteratorRemainingCount: requestID +=1 request = qbxml.customer_request_iterative(requestID=requestID,iteratorID=iteratorID) session_manager.queue_session({'reqXML':request,'ticket':ticket,'callback':iterate_customers_continue,'updatePauseSeconds':"",'minimumUpdateSeconds':60,'MinimumRunEveryNSeconds':45})
def iterate_customers_continue(ticket, responseXML): db.insert_customer(responseXML) root = etree.fromstring(responseXML) # do something with the response, store it in a database, return it somewhere etc requestID = int(root.xpath('//CustomerQueryRs/@requestID')[0]) iteratorRemainingCount = int( root.xpath('//CustomerQueryRs/@iteratorRemainingCount')[0]) iteratorID = root.xpath('//CustomerQueryRs/@iteratorID')[0] print "iteratorID", iteratorID, "iteratorRemainingCount:", iteratorRemainingCount, 'requestID', requestID if iteratorRemainingCount: requestID += 1 request = qbxml.customer_request_iterative(requestID=requestID, iteratorID=iteratorID) session_manager.queue_session({ 'reqXML': request, 'ticket': ticket, 'callback': iterate_customers_continue, 'updatePauseSeconds': "", 'minimumUpdateSeconds': 60, 'MinimumRunEveryNSeconds': 45 })
def iterate_customers_start(): request = qbxml.customer_request_iterative() session_manager.queue_session({'reqXML':request,'ticket':"",'callback':iterate_customers_continue,'updatePauseSeconds':"",'minimumUpdateSeconds':60,'MinimumRunEveryNSeconds':45})