Example #1
0
    def testMiner(self):
        """ Check if the Miner class can download files correctly from the company server. """

        m = Miner(self.session,
                  self.directory,
                  overwrite=True)

        random_day = randint(1, 28)
        random_month = randint(1, 12)
        self.day = date(2014, random_month, random_day)

        print('Testing file download for %s.' % str(self.day))
        soups = m.mine(self.day)

        if not soups:
            # No jobs on that day... try again
            self.testMiner()
        else:
            for soup in soups:
                self.assertIsInstance(soup.data, BeautifulSoup)
                self.assertIsInstance(soup.stamp.date, date)
                self.assertIsInstance(soup.stamp.uuid, str)

                order_detail = soup.data.find(id='order_detail')
                self.assertIsNotNone(order_detail)
Example #2
0
def bulk_download():

    u = User('m-134', 'PASSWORD')
    m = Miner(u.remote_session, u.username)

    start = date(2013, 3, 1)
    end = date(2014, 12, 24)
    delta = end - start

    soups = list()
    for n in range(delta.days):
        day = start + timedelta(days=n)
        soup = m.mine(day)
        soups.append(soup)

    return soups