Beispiel #1
0
        cat1.write_csv('cat1')
        cat1.write_csv('cat1')
        progress_monitor.complete()

    elif(args.slide == 3):
        # play with Scraper class
        print("This runs the whole website scraping")
        print("You can check the generated files in demo/slide3")

        move_to_path('demo/slide3')

        site_url = 'http://books.toscrape.com'
        site = Scraper(site_url)
        progress_monitor.complete()

    elif(args.slide == 4):
        # play with FileIO class
        print("This scrape an image")
        print("You can check the generated files in demo/slide4")

        move_to_path('demo/slide4')

        image_url = 'http://books.toscrape.com/media/cache/a3/9e/a39e7c5c9fc61c2ae0f81116aa8cbb0e.jpg'
        FileIO.download_image(image_url, 'demo.jpg')

    else:
        # Scrap the website
        site_url = 'http://books.toscrape.com'
        site = Scraper(site_url)
        progress_monitor.complete()
Beispiel #2
0
 def test_download_image(self):
     url = "http://books.toscrape.com/media/cache/c0/59/c05972805aa7201171b8fc71a5b00292.jpg"
     name = "testdownload.jpg"
     FileIO.download_image(url, name)
     assert path.exists(name)
     remove(name)
Beispiel #3
0
 def save_image(self):
     """ Copy the remote image in the current local directory """
     self.image_local = self.__get_image_name()
     FileIO.download_image(self.image_url, self.image_local)