def get_related(self): uids = [] items_tree = ET.fromstring(get_url(self.__atms_xml_url)) for item in items_tree.iter('item'): bank = item.find('bank').text if bank in self.__related_uids: uids.append(self.__related_uids[bank]) else: warning_has_more_related(self.uid, bank) return sorted(filter_empty(set(uids)))
def __parse_office(self, item): point, more = self.__parse_base(item) point.type = TYPE_OFFICE point.check_information = CHECK_OFFICIAL for section in map(PQ, more(".content .section")): section_type = normalize_text(section(".name").text()) if section_type not in self.__office_sections_types: continue section_value = section(".text") type = self.__office_sections_types[section_type] if type == "time": time_html = replace_br(section_value.html(), ",") time_text = ", ".join([item.text() for item in map(PQ, PQ(time_html)("td"))]) point.time = normalize_time(time_text) elif type == "phone": phones_html = replace_br(section_value.html(), ",") phones_text = normalize_text(PQ(phones_html).text()) point.phones = filter_empty(map(normalize_phone, phones_text.split(","))) warning_not_official_coordinates(point) return point
def __parse_base_atm_terminal(self, item, city_name, point_type): point = self.__parse_base(item, city_name, point_type) point.place = item('td:eq(1)').text() point.currency = filter_empty(map(normalize_text, PQ(replace_br(item('td:eq(2)').html(), ',')).text().split(','))) point.time = self.__parse_time(item('td:eq(3)')) return point
def normalize_phones(phones): return filter_empty(map(normalize_phone, phones))