Example #1
0
        except Exception,e:
            logger.info('Cannot parse breakfast info with error: ' + str(e))

        try:
            if '加床' in room.room_desc:
                room.is_extrabed = 'Yes'
            if '免费加床' in room.room_desc or '加床免费' in room.room_desc:
                room.is_extrabed_free = 'Yes'
        except Exception, e:
            logger.info('Cannor parse extrabed info with error: ' + str(e))

        try:
            try:
                total_price = each_hotel['chargeableRoomRateTotal']
                tax_price = each_hotel['chargeableRoomRateTaxesAndFees']
                room.tax = float(str(tax_price))
                room.price = float(str(total_price)) - room.tax
            except:
                total_price = each_hotel['chargeableRoomRateTotal']
                room.price = float(str(total_price))
                room.tax = 0
        except Exception,e:
            logger.error('Cannot parse this room\'s price with error:' + str(e))
            continue

        try:
            if '三人' in room.room_type or '3' in room.bed_type:
                room.occupancy = 3
            elif '四人' in room.room_type or '4' in room.bed_type:
                room.occupancy = 4
            else:
Example #2
0
        except Exception, e:
            logger.info('Cannot parse breakfast info with error: ' + str(e))

        try:
            if '加床' in room.room_desc:
                room.is_extrabed = 'Yes'
            if '免费加床' in room.room_desc or '加床免费' in room.room_desc:
                room.is_extrabed_free = 'Yes'
        except Exception, e:
            logger.info('Cannor parse extrabed info with error: ' + str(e))

        try:
            try:
                total_price = each_hotel['chargeableRoomRateTotal']
                tax_price = each_hotel['chargeableRoomRateTaxesAndFees']
                room.tax = float(str(tax_price))
                room.price = float(str(total_price)) - room.tax
            except:
                total_price = each_hotel['chargeableRoomRateTotal']
                room.price = float(str(total_price))
                room.tax = 0
        except Exception, e:
            logger.error('Cannot parse this room\'s price with error:' +
                         str(e))
            continue

        try:
            if '三人' in room.room_type or '3' in room.bed_type:
                room.occupancy = 3
            elif '四人' in room.room_type or '4' in room.bed_type:
                room.occupancy = 4
Example #3
0
                except Exception, e:
                    #logger.info('haodingHotel::Cannot parse id of this room!')
                    #logger.info('haodingHotel::' + str(e))
                #print room.source_roomid  
                try:
                    room.occupancy = occupancy_num_pat.findall(each_room_content)[0]
                except:
                    room.occupancy = 2

                try:
                    if city_name_zh == '布达佩斯':
                        hotel_name_info_temp = hotel_name_info_pat.findall(content)[0]
                        hotel_star_temp = hotel_star_pat.findall(hotel_name_info_temp)[0]
                        hotel_star = int(hotel_star_temp)
                        if hotel_star == 5:
                            room.tax = int(room.price * 0.22)
                        else:
                            room.tax = int(room.price * 0.18)
                    else:
                        tax_per = hotel_dict[city_name_zh]
                        room.tax = int(room.price * tax_per)
                except:
                    #logger.info('haodingHotel::Parse room tax failed!')
                    continue
                        
                room_tuple = (room.hotel_name, room.city, room.source, room.source_hotelid, room.source_roomid, \
                        room.real_source, room.room_type, room.occupancy, room.bed_type, room.size, room.floor, \
                        room.check_in, room.check_out, room.price, room.tax, room.currency, room.is_extrabed, \
                        room.is_extrabed_free, room.has_breakfast, room.is_breakfast_free, room.is_cancel_free, \
                        room.room_desc)
                #print room_tuple