コード例 #1
0
ファイル: tc.py プロジェクト: tbicr/BankParsers
    def get_offices(self):
        points = []

        point = Point()
        point.prov = self.uid
        point.type = TYPE_OFFICE
        point.name = u'Главный офис'
        point.address = u'г. Минск, ул. Тимирязева, 65а'
        point.place = u'второй этаж'
        point.phones = [u'+375173121012', u'+375172863333']
        point.time = u'пн-чт: 08:30-17:30, пт: 08:30-16:15, перерыв: 13:00-13:45'
        point.check_information = CHECK_OFFICIAL
        if point.lat and point.lng:
            point.check_coordinates = CHECK_OFFICIAL
        else:
            warning_not_official_coordinates(point)
        points.append(point)

        point = Point()
        point.prov = self.uid
        point.type = TYPE_OFFICE
        point.name = u'ЦБУ №1'
        point.address = u'г. Минск, ул. Комсомольская, 26'
        point.phones = [u'+375172202622', u'+375172202722', u'+375172202422']
        point.time = u'пн-чт: 09:00-16:30, пт и предпраздничные дни: 09:30-15:00, перерыв: 13:00-13:45'
        point.check_information = CHECK_OFFICIAL
        if point.lat and point.lng:
            point.check_coordinates = CHECK_OFFICIAL
        else:
            warning_not_official_coordinates(point)
        points.append(point)

        return points
コード例 #2
0
ファイル: bveb.py プロジェクト: umax/BankParsers
    def __parse_base_office_exchange(self, item, point_type, name_keywords):
        point = Point()
        point.prov = self.uid
        point.type = point_type
        point.name = normalize_text(item('th:eq(0) a:eq(0)').text())
        if not point.name.startswith(name_keywords):
            return None

        city = normalize_text(item('td:eq(1)').text())
        address = normalize_text(item('td:eq(2)').text())
        point.address, point.place = split_address_place(u'г. %s, %s' % (city, address))
        point.check_information = CHECK_OFFICIAL

        for lat, lng, type_id, description in self.__get_coordinates():
            if u'Минск' not in point.address or type_id != '1':
                continue
            for token in description.split():
                if token not in point.address and token not in point.name:
                    break
            else:
                point.lat = lat
                point.lng = lng
                point.check_coordinates = CHECK_OFFICIAL
                break
        else:
            warning_not_official_coordinates(point)
        return point
コード例 #3
0
ファイル: belinvest.py プロジェクト: umax/BankParsers
    def __parse_base_office_exchange(self, item, map_points, point_type, start_names):
        point = Point()
        point.prov = self.uid
        point.type = point_type
        point.name = normalize_text(item('.name').text())
        if not point.name.startswith(start_names):
            return None

        point.address, point.place = split_address_place(item('.addres strong').text())
        sub_item = item('.item_block tr:last')
        point.phones = normalize_phones(sub_item('td:eq(0)').text().split(','))
        mon_thu = u'пн-чт: ' + sub_item('td:eq(2)').text()
        fri = u'пт: ' + sub_item('td:eq(3)').text()
        sat = u'сб: ' + sub_item('td:eq(4)').text()
        sun = u'вс: ' + sub_item('td:eq(5)').text()
        point.time = normalize_time(', '.join([mon_thu, fri, sat, sun]))
        point.check_information = CHECK_OFFICIAL

        for lng, lat, name, address, place in map_points:
            if (point.name in name if point.name and name else True) and\
               (point.address and address and point.address in address) and\
               (point.place in place if point.place and place else True):
                point.lat = lat
                point.lng = lng
                point.check_coordinates = CHECK_OFFICIAL
                break
        else:
            warning_not_official_coordinates(point)

        return point
コード例 #4
0
ファイル: bveb.py プロジェクト: umax/BankParsers
    def __parse_terminal(self, item):
        point = Point()
        point.prov = self.uid
        point.type = TYPE_TERMINAL

        city = normalize_text(item('td:eq(0)').text())
        address = normalize_text(item('td:eq(2)').text())
        point.address, point.place = split_address_place(u'г. %s, %s' % (city.title(), address))
        point.place = normalize_text(item('td:eq(1)').text())
        point.time = normalize_time(item('td:eq(3)').text())
        point.check_information = CHECK_OFFICIAL

        for lat, lng, type_id, description in self.__get_coordinates():
            if u'Минск' not in point.address or type_id != '2':
                continue
            for token in description.split():
                if token not in point.address:
                    break
            else:
                point.lat = lat
                point.lng = lng
                point.check_coordinates = CHECK_OFFICIAL
                break
        else:
            warning_not_official_coordinates(point)
        return point
コード例 #5
0
ファイル: bnb.py プロジェクト: tbicr/BankParsers
 def __get_offices(self, url, city_name=''):
     points = []
     page = PQ(get_url(url).decode('utf8'))
     time = None
     for item in map(PQ, page('#oo__content_value table tr:gt(0)')):
         if item('td').attr('colspan') == '3':
             continue
         point = Point()
         point.prov = self.uid
         point.type = TYPE_OFFICE
         point.name = normalize_text(item('td:eq(0)').text())
         point.address = normalize_address(city_name + item('td:eq(1) p:eq(0)').text())
         place = item('td:eq(1) p:eq(2)').text()
         if not place:
             place = item('td:eq(1) p:eq(1)').text()
         if place:
             point.place = normalize_text(place)
         new_time = item('td:eq(2)').text()
         if new_time:
             time = new_time
         point.time = normalize_time(time)
         point.check_information = CHECK_OFFICIAL
         if point.address in self.__addresses:
             point.lat, point.lng = self.__addresses[point.address]
             point.check_coordinates = CHECK_OFFICIAL
         else:
             warning_not_official_coordinates(point)
         points.append(point)
     return points
コード例 #6
0
ファイル: credex.py プロジェクト: tbicr/BankParsers
    def get_offices(self):
        points = []
        point = Point()
        point.prov = self.uid
        point.type = TYPE_OFFICE
        point.name = u'Головное отделение'
        point.address = u'г. Минск, ул. Некрасова, 114'
        point.lat = 53.940182
        point.lng = 27.56712
        point.phones = [u'88011006000']
        point.time = u'пн-чт: 09.00-17.00, перерыв: 13.00-13.50, пт и предпраздничные дни: 09.00-16.00, перерыв: 13.00-13.40, сб, вс: выходные'
        point.check_coordinates = CHECK_OFFICIAL
        point.check_information = CHECK_OFFICIAL
        points.append(point)

        page = PQ(get_url(self.__parse_data_office_cbu_url))
        for item in map(PQ, page('.itemFilial')):
            point = self.__parse_office(item)
            if point:
                points.append(point)

        page = PQ(get_url(self.__parse_data_office_retail_url))
        for item in map(PQ, page('.itemFilial')):
            point = self.__parse_office(item)
            if point:
                points.append(point)

        return points
コード例 #7
0
ファイル: homecredit.py プロジェクト: tbicr/BankParsers
 def __parse_base(self, item, city, point_type):
     point = Point()
     point.prov = self.uid
     point.type = point_type
     point.name = normalize_text(item('.b-map-side>h5').text())
     point.address, point.place = split_address_place(u'г. %s, %s' % (city, item('.b-map-side>p span:eq(0)').text()))
     coordinates = item('.b-map-side>p span:eq(1)').text()
     if coordinates:
         point.lat, point.lng = map(strip, coordinates.split(','))
     text_html = replace_br(item('.b-map-side-more').html(), ';;;')
     time_items = []
     for sub_item in map(normalize_text, PQ(text_html).text().split(';;;')):
         if not sub_item:
             continue
         if sub_item.startswith(u'Телефон:'):
             point.phones = normalize_phones(sub_item[len(u'Телефон:')].split(','))
             continue
         time_items.append(sub_item)
     point.time = normalize_time(', '.join(time_items))
     point.check_information = CHECK_OFFICIAL
     if point.lat and point.lng:
         point.check_coordinates = CHECK_OFFICIAL
     else:
         warning_not_official_coordinates(point)
     return point
コード例 #8
0
ファイル: belros.py プロジェクト: umax/BankParsers
    def __parse_base(self, item, city_name, point_type):
        point = Point()
        point.prov = self.uid
        point.type = point_type

        point.phones = [normalize_phone(item('.content_table table tbody tr:eq(0) td:eq(0) .office_phone').remove().text())]
        name_address_html = replace_br(item('.content_table table tbody tr:eq(0) td:eq(0)').remove().html(), ',')
        name, address = PQ(name_address_html).text().split(',', 1)
        point.name = normalize_text(name)
        point.address, point.place = self.__get_address(city_name, address)
        point.check_information = CHECK_OFFICIAL

        script_text = item('.ya_map script:eq(1)').text()
        for line in map(strip, script_text.splitlines()):
            if line.startswith('BX_GMapAddPlacemark('):
                lat_token = "'LAT':'"
                lat_start_index = line.find(lat_token) + len(lat_token)
                lat_end_index = line.find("'", lat_start_index)
                point.lat = line[lat_start_index:lat_end_index]
                lng_token = "'LON':'"
                lng_start_index = line.find(lng_token) + len(lng_token)
                lng_end_index = line.find("'", lng_start_index)
                point.lng = line[lng_start_index:lng_end_index]
                point.check_coordinates = CHECK_OFFICIAL
                break
        else:
            warning_not_official_coordinates(point)
        return point
コード例 #9
0
ファイル: prior.py プロジェクト: tbicr/BankParsers
 def __parse_base_atm_terminal(self, row, point_type, coordinates, deposit=False):
     point = Point()
     point.prov = self.uid
     point.type = point_type
     point.name = normalize_text(u'№' + str(int(row[1])))
     city = row[2]
     if u'р-н' not in row[2]:
         city = u'г. %s' % city
     point.address = normalize_address(u'%s, %s' % (city, row[3]))
     point.place = normalize_text(row[4])
     if u'только безнал.платежи' in row[5]:
         point.currency = []
         if deposit:
             point.deposit = False
     else:
         point.currency = map(strip, row[5].split(','))
         if deposit:
             point.deposit = True
     point.time = normalize_time(row[6])
     point.check_information = CHECK_OFFICIAL
     point.lat, point.lng = self.__get_point_coordinate(point.address, coordinates)
     if point.lat and point.lng:
         point.check_coordinates = CHECK_OFFICIAL
     else:
         warning_not_official_coordinates(point)
     return point
コード例 #10
0
ファイル: bsb.py プロジェクト: umax/BankParsers
 def get_offices(self):
     points = []
     items_tree = ET.fromstring(get_url(self.__offices_xml_url))
     for item in items_tree.iter('item'):
         point = self.__parse_office(item)
         if point:
             points.append(point)
     page = PQ(get_url(self.__regional_offices_page_url))
     point = None
     for item in map(PQ, page('#content_internal span:eq(0)').children()):
         if item[0].tag not in self.__regional_offices_tags:
             continue
         if item[0].tag == 'h2':
             point = Point()
             point.prov = self.uid
             point.type = TYPE_OFFICE
             point.name = trim_spaces_and_commas(normalize_text(item.text()))
             point.check_information = CHECK_OFFICIAL
             continue
         if not point:
             continue
         item_html = replace_br(item.html(), ';;;')
         sub_items = PQ(item_html).text().split(';;;')
         point.address, point.place = split_address_place(sub_items[0])
         for sub_item in map(normalize_text, sub_items[1:]):
             if sub_item.startswith(u'т.ф.:'):
                 point.phone = normalize_phones(sub_item[len(u'т.ф.:'):].split(','))
         warning_not_official_coordinates(point)
         points.append(point)
         point = None
     return points
コード例 #11
0
ファイル: irb.py プロジェクト: tbicr/BankParsers
    def get_offices(self):
        points = []

        point = Point()
        point.prov = self.uid
        point.type = TYPE_OFFICE
        point.name = u'Офис №1'
        point.address = u'г. Минск, пер. Промышленный, 11'
        point.time = u'пн-чт: 08:30-17:15, пт: 08:30-16:15, обед: 13:00-13:30, сб, вс: выходной'
        point.check_information = CHECK_OFFICIAL
        warning_not_official_coordinates(point)
        points.append(point)

        point = Point()
        point.prov = self.uid
        point.type = TYPE_OFFICE
        point.name = u'Офис №2'
        point.address = u'г. Минск, ул. Л.Беды, 2'
        point.phones = [u'+375172372580']
        point.time = u'пн-пт: 08:30-17:30, обед: 13:00-14:00, сб, вс: выходной'
        point.check_information = CHECK_OFFICIAL
        warning_not_official_coordinates(point)
        points.append(point)

        point = Point()
        point.prov = self.uid
        point.type = TYPE_OFFICE
        point.name = u'ЦБУ №701'
        point.address = u'г. Минск, ул. Я.Коласа, 37'
        point.phones = [u'+375172925931', u'+375172925932']
        point.time = u'пн-пт: 09:00-19:00, сб: 10:00-17:00, вс: выходной'
        point.check_information = CHECK_OFFICIAL
        warning_not_official_coordinates(point)
        points.append(point)

        point = Point()
        point.prov = self.uid
        point.type = TYPE_OFFICE
        point.name = u'ЦБУ №702'
        point.address = u'г. Минск, ул. Притыцкого, 89'
        point.phones = [u'+375172546045', u'+375172563014']
        point.time = u'пн-пт: 09:00-19:00, сб: 10:00-17:00, вс: выходной'
        point.check_information = CHECK_OFFICIAL
        warning_not_official_coordinates(point)
        points.append(point)

        return points
コード例 #12
0
ファイル: trust.py プロジェクト: tbicr/BankParsers
 def __parse_exchange(self, item):
     point = Point()
     point.prov = self.uid
     point.type = TYPE_EXCHANGE
     sub_items = item.text().split(u'—')
     point.name = normalize_text(sub_items[0])
     point.address, point.place = split_address_place(sub_items[1])
     point.check_information = CHECK_OFFICIAL
     warning_not_official_coordinates(point)
     return point
コード例 #13
0
ファイル: vtb.py プロジェクト: tbicr/BankParsers
 def __parse_terminal(self, item):
     point = Point()
     point.prov = self.uid
     point.type = TYPE_TERMINAL
     point.address, point.place = split_address_place(item('td:eq(1)').text())
     point.time = normalize_time(item('td:eq(2)').text())
     point.deposit = u'Пополнение карточки наличными' in item('td:eq(3)').text()
     point.check_information = CHECK_OFFICIAL
     warning_not_official_coordinates(point)
     return point
コード例 #14
0
ファイル: vtb.py プロジェクト: tbicr/BankParsers
 def __parse_atm(self, item):
     point = Point()
     point.prov = self.uid
     point.type = TYPE_ATM
     point.address, point.place = split_address_place(item('td:eq(1)').text())
     point.time = normalize_time(item('td:eq(2)').text())
     point.currency = map(strip, item('td:eq(3)').text().split(','))
     point.check_information = CHECK_OFFICIAL
     warning_not_official_coordinates(point)
     return point
コード例 #15
0
ファイル: rrb.py プロジェクト: tbicr/BankParsers
 def __parse_terminal(self, item):
     point = Point()
     point.prov = self.uid
     point.type = TYPE_TERMINAL
     city = u'г. %s' % normalize_text(item('td:eq(0)').text()).title()
     point.address = normalize_address(u'%s, %s' % (city, item('td:eq(1)').text()))
     point.place = normalize_text(item('td:eq(2)').text())
     point.time = normalize_time(item('td:eq(3)').text())
     point.check_information = CHECK_OFFICIAL
     warning_not_official_coordinates(point)
     return point
コード例 #16
0
ファイル: belarus.py プロジェクト: tbicr/BankParsers
 def __parse_terminal(self, item):
     point = Point()
     point.prov = self.uid
     point.type = TYPE_TERMINAL
     point.name = normalize_text(item('td:eq(0)').text())
     point.address, point.place = split_address_place(item('td:eq(1)').text())
     point.place = point.name
     point.time = normalize_time(item('td:eq(2)').text())
     point.deposit = normalize_text(item('td:eq(3)').text()).lower() == u'есть'
     point.check_information = CHECK_OFFICIAL
     warning_not_official_coordinates(point)
     return point
コード例 #17
0
ファイル: rrb.py プロジェクト: tbicr/BankParsers
 def __parse_atm(self, item):
     point = Point()
     point.prov = self.uid
     point.type = TYPE_ATM
     city = u'г. %s' % normalize_text(item('td:eq(0)').text()).title()
     point.address = normalize_address(u'%s, %s' % (city, item('td:eq(1)').text()))
     point.place = normalize_text(item('td:eq(2)').text())
     point.currency = map(strip, item('td:eq(3)').text().split(','))
     point.time = normalize_time(item('td:eq(4)').text())
     point.check_information = CHECK_OFFICIAL
     warning_not_official_coordinates(point)
     return point
コード例 #18
0
ファイル: fransa.py プロジェクト: umax/BankParsers
 def __parse_exchange(self, item, city):
     point = Point()
     point.prov = self.uid
     point.type = TYPE_EXCHANGE
     point.name = normalize_text(item('td:eq(0)').text())
     point.address, point.place = split_address_place(u'г. %s, %s' % (city, item('td:eq(1)').text()))
     if len(item('td')) == 4:
         point.time = normalize_time(item('td:eq(2)').text())
     else:
         point.time = normalize_time(item('td:eq(2)').text().split(u'Операции:')[0])
     point.check_information = CHECK_OFFICIAL
     warning_not_official_coordinates(point)
     return point
コード例 #19
0
ファイル: belgazprom.py プロジェクト: tbicr/BankParsers
 def __parse_base(self, item, city_name, point_type):
     point = Point()
     point.prov = self.uid
     point.type = point_type
     point.address, point.place = self.__parse_address(city_name, item('td:eq(0) a').text())
     point.check_information = CHECK_OFFICIAL
     point.lat = item('td:eq(0) .item_coords .coord1').text()
     point.lng = item('td:eq(0) .item_coords .coord2').text()
     if point.lat and point.lng:
         point.check_coordinates = CHECK_OFFICIAL
     else:
         warning_not_official_coordinates(point)
     return point
コード例 #20
0
ファイル: h.py プロジェクト: tbicr/BankParsers
    def get_offices(self):
        points = []

        point = Point()
        point.prov = self.uid
        point.type = TYPE_OFFICE
        point.address = u'г. Минск, ул. Клары Цеткин, д. 51, пом. 1'
        point.phones = [u'+375173060690', u'+375173062591']
        point.time = u'пн-чт: 08:30-17:30, обед: 12:30-13:15, пт: 08:30-16:15, обед: 12:30-13:15'
        point.check_information = CHECK_OFFICIAL
        warning_not_official_coordinates(point)
        points.append(point)

        return points
コード例 #21
0
ファイル: tb.py プロジェクト: tbicr/BankParsers
 def __parse_atm(self, item, city, coordinates):
     point = Point()
     point.prov = self.uid
     point.type = TYPE_ATM
     point.address = normalize_address(u'%s, %s' % (city, item('td:eq(2)').text()))
     point.place = normalize_text(item('td:eq(1)').text())
     point.currency = map(strip, item('td:eq(4)').text().replace('EURO', 'EUR').split(','))
     point.time = normalize_time(item('td:eq(3)').text())
     point.check_information = CHECK_OFFICIAL
     point.lat, point.lng = self.__get_point_coordinate(point, coordinates)
     if point.lat and point.lng:
         point.check_coordinates = CHECK_OFFICIAL
     else:
         warning_not_official_coordinates(point)
     return point
コード例 #22
0
ファイル: prior.py プロジェクト: tbicr/BankParsers
 def __parse_office_main(self, coordinates):
     point = Point()
     point.prov = self.uid
     point.type = TYPE_OFFICE
     point.name = u'Центральный офис'
     point.address = u'г. Минск, ул. В.Хоружей, 31а'
     point.phones = [u'+375172899090', u'+375172899292']
     point.time = u'пн-чт: 08:30-17:30, пт: 08:30-16:15, перерыв: 12:30-13:15, сб, вс: выходной'
     point.check_information = CHECK_OFFICIAL
     point.lat, point.lng = self.__get_point_coordinate(point.address, coordinates)
     if point.lat and point.lng:
         point.check_coordinates = CHECK_OFFICIAL
     else:
         warning_not_official_coordinates(point)
     return point
コード例 #23
0
ファイル: trust.py プロジェクト: tbicr/BankParsers
 def __parse_terminal(self, item):
     point = Point()
     point.prov = self.uid
     point.type = TYPE_TERMINAL
     point.address, point.place = split_address_place(item('td:eq(2)').text())
     point.place = normalize_text(item('td:eq(1)').text())
     point.currency = map(strip, item('td:eq(4)').text().split(','))
     if point.currency:
         point.deposit = True
     else:
         point.deposit = False
     point.time = normalize_time(item('td:eq(3)').text())
     point.check_information = CHECK_OFFICIAL
     warning_not_official_coordinates(point)
     return point
コード例 #24
0
ファイル: euro.py プロジェクト: tbicr/BankParsers
 def __parse_office(self, item):
     point = Point()
     point.prov = self.uid
     point.type = TYPE_OFFICE
     point.name = normalize_text(item('td:eq(0)').text())
     address_items = item('td:eq(1)').text().split(u'тел.')
     address = address_items[0]
     point.address, point.place = split_address_place(address)
     if len(address_items) > 1:
         phone = address_items[1]
         phones_items = phone.split(u'доб')
         point.phones = normalize_phones(phones_items[0].split(','))
     point.time = self.__parse_time(item)
     point.check_information = CHECK_OFFICIAL
     warning_not_official_coordinates(point)
     return point
コード例 #25
0
ファイル: trust.py プロジェクト: tbicr/BankParsers
 def __parse_office(self, item):
     point = Point()
     point.prov = self.uid
     point.type = TYPE_OFFICE
     point.name = normalize_text(item('h1').text())
     point.address, point.place =  split_address_place(item('tr:eq(2) td:eq(1)').text())
     phones = []
     phone_html = replace_br(item('tr:eq(5) td:eq(1)').html(), ';;;')
     if phone_html:
         phones += map(strip, PQ(phone_html).text().split(';;;'))
     phone_html = replace_br(item('tr:eq(6) td:eq(1)').html(), ';;;')
     if phone_html:
         phones += map(strip, PQ(phone_html).text().split(';;;'))
     point.phones = normalize_phones(filter(lambda phone: phone.startswith((u'+', u'тел')), phones))
     point.time = normalize_time(item('tr:eq(8) td:eq(1)').text())
     point.check_information = CHECK_OFFICIAL
     warning_not_official_coordinates(point)
     return point
コード例 #26
0
ファイル: bnb.py プロジェクト: tbicr/BankParsers
 def get_atms(self):
     points = []
     page = PQ(get_url(self.__parse_list_atm_url).decode('utf8'))
     for item in map(PQ, page('#oo__content_value table tr:gt(0)')):
         point = Point()
         point.prov = self.uid
         point.type = TYPE_ATM
         point.address = normalize_address(item('td:eq(0) p:eq(0)').text())
         point.place = normalize_text(item('td:eq(1)').text())
         point.time = normalize_time(item('td:eq(2)').text())
         point.currency = map(self.__get_currency, item('td:eq(3) p'))
         point.check_information = CHECK_OFFICIAL
         if point.address in self.__addresses:
             point.lat, point.lng = self.__addresses[point.address]
             point.check_coordinates = CHECK_OFFICIAL
         else:
             warning_not_official_coordinates(point)
         points.append(point)
     return points
コード例 #27
0
ファイル: mm.py プロジェクト: tbicr/BankParsers
 def __parse_office(self, item, city):
     point = Point()
     point.prov = self.uid
     point.type = TYPE_OFFICE
     point.name = normalize_text(item('th .pointShowMaps span:eq(0)').text())
     address = item('th .pointShowMaps span:eq(1)').text()
     point.address, point.place = split_address_place(u'г. %s, %s' % (city, address))
     time_html = replace_br(item('td:eq(0)').html(), ', ')
     point.time = normalize_time(PQ(time_html).text())
     phones_html = replace_br(item('td:eq(1)').html(), ', ')
     point.phones = normalize_phones(PQ(phones_html).text().split(','))
     point.lat = normalize_text(item('th .item_coords .coord1').text())
     point.lng = normalize_text(item('th .item_coords .coord2').text())
     point.check_information = CHECK_OFFICIAL
     if point.lat and point.lng:
         point.check_coordinates = CHECK_OFFICIAL
     else:
         warning_not_official_coordinates(point)
     return point
コード例 #28
0
ファイル: bnb.py プロジェクト: tbicr/BankParsers
 def get_exchanges(self):
     points = []
     page = PQ(get_url(self.__parse_list_exchange_url).decode('utf8'))
     for item in map(PQ, page('#oo__content_value table tr:gt(0)')):
         point = Point()
         point.prov = self.uid
         point.type = TYPE_EXCHANGE
         add_city_literal = (u'Минск', u'Витебск')
         address = normalize_text(item('td:eq(0)').text())
         point.address = normalize_address((u'г. ' + address) if address.startswith(add_city_literal) else address)
         point.place = normalize_text(item('td:eq(1)').text())
         point.time = normalize_time(item('td:eq(2)').text())
         point.check_information = CHECK_OFFICIAL
         if point.address in self.__addresses:
             point.lat, point.lng = self.__addresses[point.address]
             point.check_coordinates = CHECK_OFFICIAL
         else:
             warning_not_official_coordinates(point)
         points.append(point)
     return points
コード例 #29
0
ファイル: tb.py プロジェクト: tbicr/BankParsers
 def __parse_office_exchange(self, item, city, coordinates, point_type, point_keywords):
     point = Point()
     point.prov = self.uid
     point.type = point_type
     point.name = normalize_text(item('th:eq(0)').text())
     if not point.name.startswith(point_keywords):
         return None
     address_html = replace_br(item('td:eq(0)').html(), ';;;')
     address_items = PQ(address_html).text().split(';;;', 1)
     point.address = normalize_address(u'%s, %s' % (city, address_items[0]))
     if len(address_items) > 1:
         point.place = normalize_text(address_items[1])
     item('td:eq(1) ul, td:eq(1) li').remove()
     point.time = normalize_time(item('td:eq(1)').text())
     point.phones = normalize_phones(map(lambda phone_item: PQ(phone_item).text(), item('td:eq(2) p') or item('td:eq(2)')))
     point.check_information = CHECK_OFFICIAL
     point.lat, point.lng = self.__get_point_coordinate(point, coordinates)
     if point.lat and point.lng:
         point.check_coordinates = CHECK_OFFICIAL
     else:
         warning_not_official_coordinates(point)
     return point
コード例 #30
0
ファイル: credex.py プロジェクト: tbicr/BankParsers
 def __parse_base_office_exchange(self, item, point_type):
     point = Point()
     point.prov = self.uid
     point.type = point_type
     point.name = normalize_text(item('h2').text())
     point.address = normalize_address(item('.itemFilialIn>p:eq(0)').text()[len(u'Почтовый адрес:') + 1:])
     is_phone = False
     phones_items = self.__phone_splitter.split(item('.itemFilialIn>p:eq(1)').text() or '')
     for sub_item in phones_items:
         sub_item = normalize_text(sub_item).lower()
         if sub_item == u'телефон':
             is_phone = True
             continue
         if sub_item == u'факс':
             is_phone = False
             continue
         if is_phone:
             point.phones.append(normalize_phone(sub_item))
     point.time = normalize_time(', '.join(map(lambda sub_item: PQ(sub_item).text(), item('.workTime p'))))
     point.check_information = CHECK_OFFICIAL
     warning_not_official_coordinates(point)
     return point