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