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
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 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.package,flight.stop_id,flight.stop_time,\ flight.daydiff,flight.source,flight.return_rule,flight.change_rule,flight.stop,flight.share_flight,flight.stopby,\ flight.baggage,flight.transit_visa,flight.reimbursement,flight.flight_meals,flight.ticket_type,flight.others_info) tickets.append(flight_tuple) other_info = flight_info.get_element_by_id( 'idFlightRecommendationOutbound_' + str(i)).find_class('on') for k in range(len(other_info)): cabin = cabin_pat.findall( other_info[k].find_class('price')[0].xpath('./@onclick')[0])[0] cabin = cabin[1:-1]