Esempio n. 1
0
def insert_prices(city, postal_code):
    index = 1
    next_page = True
    while next_page:
        printer('Fetching prices with city {0} and postal code {1}'.format(city, postal_code))
        html_page = prices_access.load_html(postal_code, index)
        prices = parser.parse_prices(html_page, city, postal_code)
        exporter.print_prices(prices, printer)
        db_access.insert_prices(prices)
        if (parser.has_next_link(html_page)):
            index += 1
        else:
            next_page = False
Esempio n. 2
0
 def test_print_prices(self):
     csv_exporter.print_prices(self.documents, self.mock_printer)
     self.assertEqual(self.print_trace[0], 'city,postal_code,neighborhood,rooms,house_type,m2,price,price_m2,year_of_construction,floor,elevator,condition,energy_level')
     self.assertEqual(self.print_trace[1], 'Helsinki,00510,Alppila,1,apartment,55,190000,5000,1947,3,no,good,D')
Esempio n. 3
0
def load_and_print_prices():
    prices = db_access.get_prices()
    exporter.print_prices(prices, printer)