Beispiel #1
0
 def test_init_root(self):
     dirname = 'testinit'
     assert getcwd() == self.cwd
     FileIO.init_root(dirname, False)
     assert getcwd() == urljoin(self.cwd+'/', dirname)
     chdir('..')
     assert path.exists(dirname) is True
     rmdir(dirname)
Beispiel #2
0
    def __scrap_categories(self, to_csv=False):

        FileIO.init_root('data', False)
        categories = []

        progress_monitor.allbooks_init(self.num_books, self.site_url)

        for link in self.links:

            progress_monitor.category_update(
                    len(categories),
                    len(self.links),
                    link[1])

            category = Category(link[0])
            categories.append(category)

            FileIO.open_category(category.name)
            category.write_csv()
            FileIO.close_category()

        return categories