Subversion Repositories SmartDukaan

Rev

Rev 23263 | Rev 23265 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 23263 Rev 23264
Line 374... Line 374...
374
            root = fromstring(responseString)
374
            root = fromstring(responseString)
375
            print root.tag
375
            print root.tag
376
            awbs = []
376
            awbs = []
377
            for awbEle in root:
377
            for awbEle in root:
378
                
378
                
379
                awbNumber = __findElementByAttr(awbEle, 'name', 'awb_number').text  
379
                awbNumber = __findElementByAttr(awbEle, 'name', 'awb_number').text.strip()
380
                reasonCode = __findElementByAttr(awbEle, 'name', 'reason_code_number').text
380
                reasonCode = __findElementByAttr(awbEle, 'name', 'reason_code_number').text.strip()
381
                deliveryDate =  __findElementByAttr(awbEle, 'name', 'delivery_date').text
381
                deliveryDate =  __findElementByAttr(awbEle, 'name', 'delivery_date').text.strip()
382
                lastUpdateDate = __findElementByAttr(awbEle, 'name', 'last_update_date').text
382
                lastUpdateDate = __findElementByAttr(awbEle, 'name', 'last_update_date').text.strip()
383
                xmlScans = __findElementByAttr(awbEle, 'name', 'scans')
383
                xmlScans = __findElementByAttr(awbEle, 'name', 'scans')
384
                awbStatuses[awbNumber] = {'awbNumber': awbNumber, 'reasonCode': reasonCode, 'deliveryDate':deliveryDate, 'lastUpdateDate':lastUpdateDate, 'xmlScans': xmlScans}
384
                awbStatuses[awbNumber] = {'awbNumber': awbNumber, 'reasonCode': reasonCode, 'deliveryDate':deliveryDate, 'lastUpdateDate':lastUpdateDate, 'xmlScans': xmlScans}
385
            
385
            
386
        doneAwbs += batchSize
386
        doneAwbs += batchSize
387
        print awbStatuses
387
        print awbStatuses
Line 402... Line 402...
402
    print "xmlScansTag", xmlScans.text
402
    print "xmlScansTag", xmlScans.text
403
    awbStatusObj = None
403
    awbStatusObj = None
404
    for xmlScan in xmlScans:
404
    for xmlScan in xmlScans:
405
        print "xmlScanText", xmlScan.text
405
        print "xmlScanText", xmlScan.text
406
        print "xmlScanTag", xmlScan.tag
406
        print "xmlScanTag", xmlScan.tag
407
        reasonCodeNumber = __findElementByAttr(xmlScan, 'name', 'reason_code_number').text
407
        reasonCodeNumber = __findElementByAttr(xmlScan, 'name', 'reason_code_number').text.strip()
408
        if reasonCodeNumber in codes:
408
        if reasonCodeNumber in codes:
409
            statusDescription = __findElementByAttr(xmlScan, 'name', 'status').text
409
            statusDescription = __findElementByAttr(xmlScan, 'name', 'status').text.strip()
410
            statusDate = get_py_datetime(__findElementByAttr(xmlScan, 'name', 'updated_on').text)
410
            statusDate = get_py_datetime(__findElementByAttr(xmlScan, 'name', 'updated_on').text.strip())
411
            awbStatusObj = __AWBStatusObj(None, reasonCodeNumber, statusDescription, statusDate)
411
            awbStatusObj = __AWBStatusObj(None, reasonCodeNumber, statusDescription, statusDate)
412
            print awbStatusObj
412
            print awbStatusObj
413
    return awbStatusObj
413
    return awbStatusObj
414
 
414
 
415
def __findElementByAttr(xmlElement, name, value=None):
415
def __findElementByAttr(xmlElement, name, value=None):