Пример #1
0
 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
Пример #2
0
    def __parse_atm(self, item):
        point = Point()
        point.prov = self.uid
        point.type = TYPE_ATM

        city = normalize_text(item('td:eq(3)').text())
        address = normalize_text(item('td:eq(1)').text())
        point.address, point.place = split_address_place(u'г. %s, %s' % (city.title(), address))
        point.place = normalize_text(item('td:eq(0)').text())
        point.time = normalize_time(item('td:eq(2)').text())
        point.currency = map(strip, normalize_text(item('td:eq(4)').text()).split(','))
        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
Пример #3
0
 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
Пример #4
0
 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
Пример #5
0
 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
Пример #6
0
 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
Пример #7
0
 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
Пример #8
0
 def __parse_atm(self, item, city):
     point = Point()
     point.prov = self.uid
     point.type = TYPE_ATM
     address = item('th .pointShowMaps span').remove().text()
     place = normalize_text(item('th .pointShowMaps').text())
     point.address, point.place = split_address_place(u'г. %s, %s' % (city, address))
     point.place = place
     currency = item('td:eq(0)').text()
     for from_token, to_token in self.__currency_replaces:
         currency = currency.replace(from_token, to_token)
     point.currency = map(strip, currency.split(','))
     time_html = replace_br(item('td:eq(1)').html(), ', ')
     point.time = normalize_time(PQ(time_html).text())
     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
Пример #9
0
    def __parse_atm(self, item, coordinates):
        point = Point()
        point.prov = self.uid
        point.type = TYPE_ATM
        bank = item.find('bank').text
        if bank != u'ЗАО БелСвиссБанк':
            return None

        city = item.find('region').text
        address = item.find('address').text
        point.address = normalize_address(u'г. %s, %s' % (city.title(), address))
        point.place = normalize_text(item.find('location').text)
        point.time = normalize_time(item.find('time').text)
        point.currency = map(strip, item.find('currency').text.split(','))
        point.check_information = CHECK_OFFICIAL

        terminal_id = item.find('terminal_id').text
        if terminal_id in coordinates:
            point.lat, point.lng = coordinates[terminal_id]
        if point.lat and point.lng:
            point.check_coordinates = CHECK_OFFICIAL
        else:
            warning_not_official_coordinates(point)
        return point