コード例 #1
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
コード例 #2
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
コード例 #3
0
ファイル: input.py プロジェクト: jgblight/Intrepid-1.0
	def post(self):
		
		point = Point()
		point.title = self.request.get('title')
		
		if self.request.get('path'):
			point.path = True
		else:
			point.path = False
		
		point.content = cgi.escape(self.request.get('content')).replace('\r\n','<br>').replace('\n','<br>');
		
		point.lat = float(self.request.get('lat'))
		point.lng = float(self.request.get('lng'))
		
		dt = self.request.get('visit')
		if dt:
			point.date = datetime.datetime.strptime(dt,"%Y-%m-%d")
		else:
			point.date = datetime.datetime.now()
			
		point.dateStr = point.date.strftime('%b %d, %Y')
		
		if self.request.get('image'):
			point.img = db.Blob(images.resize(self.request.get('image'),500,500))
		
		point.put()
		self.redirect('/admin')
コード例 #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
ファイル: 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
コード例 #6
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
コード例 #7
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
コード例 #8
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
コード例 #9
0
ファイル: mm.py プロジェクト: tbicr/BankParsers
 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
コード例 #10
0
ファイル: belinvest.py プロジェクト: umax/BankParsers
    def __parse_base_atm_terminals(self, item, map_points, point_type, start_names):
        point = Point()
        point.prov = self.uid
        point.type = point_type
        if not item('.name').text().split()[0].startswith(start_names):
            return None

        point.address, point.place = split_address_place(' '.join(item('.name').text().strip().split()[1:]))
        point.place = trim_spaces_and_commas(normalize_text(item('.addres strong').text()))
        point.check_information = CHECK_OFFICIAL

        for lat, lng, name, address, place in map_points:
            if (name in start_names) 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
コード例 #11
0
ファイル: bsb.py プロジェクト: umax/BankParsers
    def __parse_exchange(self, item):
        point = Point()
        point.prov = self.uid
        point.type = TYPE_EXCHANGE
        point.name = normalize_text(item.find('name').text)

        city = item.find('region').text if item.find('region') else u'Минск'
        address = item.find('address').text
        point.address = normalize_address(u'г. %s, %s' % (city.title(), address))
        point.place = normalize_text(item.find('location').text)
        point.lat = item.find('lattitude').text
        point.lng = item.find('longitude').text
        point.time = normalize_time(item.find('time').text)
        if item.find('phones').text:
            point.phones = normalize_phones(item.find('phones').text.split(','))
        point.check_information = CHECK_OFFICIAL

        if point.lat and point.lng:
            point.check_coordinates = CHECK_OFFICIAL
        else:
            warning_not_official_coordinates(point)
        return point
コード例 #12
0
ファイル: credex.py プロジェクト: tbicr/BankParsers
    def get_atms(self):
        points = []

        point = Point()
        point.prov = self.uid
        point.type = TYPE_ATM
        point.name = u'АТМ 12149'
        point.address = u'г. Минск, ул. Некрасова, 114'
        point.lat = 53.940182
        point.lng = 27.56712
        point.time = u'ежедневно: 24 часа'
        point.check_coordinates = CHECK_OFFICIAL
        point.check_information = CHECK_OFFICIAL
        points.append(point)

        point = Point()
        point.prov = self.uid
        point.type = TYPE_ATM
        point.name = u'АТМ 12152'
        point.address = u'г.Минск, ул. Куйбышева, д.40, 2 ряд, 7 место'
        point.place = u'торговое место 27'
        point.lat = 53.921251
        point.lng = 27.578332
        point.time = u'вт-вс: 10:00-20:00, пн: выходной'
        point.check_coordinates = CHECK_OFFICIAL
        point.check_information = CHECK_OFFICIAL
        points.append(point)

        point = Point()
        point.prov = self.uid
        point.type = TYPE_ATM
        point.name = u'АТМ 12150'
        point.address = u'г. Минск, ул. Я.Лучины, 44'
        point.lat = 53.839188
        point.lng = 27.581946
        point.time = u'ежедневно: 08:00-23:00'
        point.check_coordinates = CHECK_OFFICIAL
        point.check_information = CHECK_OFFICIAL
        points.append(point)

        point = Point()
        point.prov = self.uid
        point.type = TYPE_ATM
        point.name = u'АТМ 12151'
        point.address = u'г. Бобруйск, ул. Социалистическая, 65/46'
        point.lat = 53.132159
        point.lng = 29.226754
        point.time = u'ежедневно: 24 часа'
        point.check_coordinates = CHECK_OFFICIAL
        point.check_information = CHECK_OFFICIAL
        points.append(point)

        point = Point()
        point.prov = self.uid
        point.type = TYPE_ATM
        point.name = u'АТМ 12153'
        point.address = u'г. Гродно, ул. Советских пограничников, 31'
        point.place = u'кафе Колобки'
        point.lat = 53.668713
        point.lng = 23.824421
        point.time = u'ежедневно: 24 часа'
        point.check_coordinates = CHECK_OFFICIAL
        point.check_information = CHECK_OFFICIAL
        points.append(point)

        return points