def DictTuple(self, Dict_list): tickets = [] flight = Flight() for every in Dict_list: flight.plane_type = every['plane_type'] flight.flight_no = every['flight_no'] flight.flight_corp = every['flight_corp'] flight.dept_day = every['dept_day'] flight.stop_time = every['stoptime'] flight.dept_time = every['dept_time'] flight.dest_time = every['dest_time'] flight.stop_id = every['stop_id'] flight.dept_id = every['dept_id'] flight.dest_id = every['dest_id'] flight.dur = every['dur'] flight.rest = every['rest'] flight.stop = every['stop'] flight.return_rule = every['return_rule'] flight.seat_type = every['seat_type'] flight.real_class = every['real_class'] flight.surcharge = every['surcharge'] flight.promotion = every['promotion'] flight.package = every['package'] flight.daydiff = every['daydiff'] flight.price = every['price'] flight.tax = every['tax'] flight_tuple = (flight.flight_no,flight.plane_type,flight.flight_corp,flight.dept_id,flight.dest_id,flight.dept_day,\ flight.dept_time,flight.dest_time,flight.dur,flight.rest,flight.price,flight.tax,flight.surcharge,\ flight.promotion,flight.currency,flight.seat_type,flight.real_class,flight.stop_id,flight.stop_time,\ flight.daydiff,flight.source,flight.return_rule,flight.stop) tickets.append(flight_tuple) return tickets
other_info.find_class('price__value')[0].xpath('./span') [1].xpath('text()')[0]) for p in price_list: price += p except Exception, e: logger.error('airfranceFlight :: price_value class not found!') result['error'] = PARSE_ERROR return result price = float(price) flight = Flight() flight.tax = 0 flight.flight_no = flight_no flight.plane_type = plane_type flight.flight_corp = flight_corp flight.dept_id = dept_id flight.dest_id = dest_id flight.dept_day = dept_day flight.dept_time = dept_time flight.dest_time = dest_time flight.dur = dur flight.price = price flight.currency = currency flight.seat_type = seat_type flight.real_class = real_class flight.stop_id = stop_id flight.stop_time = stop_time flight.daydiff = daydiff flight.source = source flight.stop = stop