def test_get_folder(self): redirect = 'http://example.com' client = BitcasaClient(self.client_id, self.secret, redirect, self.access_token) unittest_folder = client.create_folder('/', 'unittest') client.delete_folder(unittest_folder.path) unittest_folder = client.create_folder('/', 'unittest') unittest_folder_again = client.get_folder(unittest_folder.path, unittest_folder.name)
def process(self): bc = BitcasaClient("758ab3de", "5669c999ac340185a7c80c28d12a4319", "https://rosekings.com/bitcasafilelist/", self.at) logger("Getting base folder\n") base = bc.get_folder(self.baseFolder) #initialize logfiles try: if not os.path.isdir(self.tmp): os.makedirs(self.tmp) except OSError as exc: pass myFile = file("%ssuccessfiles.txt" % self.tmp, 'w+') myFile.write(time.strftime("%Y-%m-%d %H:%M:%S") + "\n") myFile.close() myFile = file("%serrorfiles.txt" % self.tmp, 'w+') myFile.write(time.strftime("%Y-%m-%d %H:%M:%S") + "\n") myFile.close() myFile = file("%sskippedfiles.txt" % self.tmp, 'w+') myFile.write(time.strftime("%Y-%m-%d %H:%M:%S") + "\n") myFile.close() logger("Starting recursion\n") self.folderRecurse(base, "", 0,0) #wait for threads to finish downoading for thread in self.threads: thread.join() #Log final speed and statistics logger("finished %s at %s\n" % (convertSize(self.bytestotal),getSpeed(self.bytestotal,time.time()-self.st)))
def process(self): bitc = BitcasaClient("758ab3de", "5669c999ac340185a7c80c28d12a4319", "https://rose-llc.com/bitcasafilelist/", self.accesstoken) log.debug("Getting base folder") base = None while base is None: try: base = bitc.get_folder(self.basefolder) except (BitcasaException, ValueError) as e: log.error("Bitcasa API Exception: %s. Retrying" % e) time.sleep( 10 ) # sleep here so that we don't exhaust api rate limit too fast except KeyboardInterrupt: raise SystemExit #initialize logfiles try: if not os.path.isdir(self.tmp): os.makedirs(self.tmp) except OSError as exc: pass myfile = file(self.successfiles, 'w+') myfile.write(time.strftime("%Y-%m-%d %H:%M:%S") + " Start\n") myfile.close() myfile = file(self.errorfiles, 'w+') myfile.write(time.strftime("%Y-%m-%d %H:%M:%S") + " Start\n") myfile.close() myfile = file(self.skippedfiles, 'w+') myfile.write(time.strftime("%Y-%m-%d %H:%M:%S") + " Start\n") myfile.close() log.debug("Starting recursion") self.folderRecurse(base, "", 0, 0) #wait for threads to finish downoading for thread in self.threads: thread.join() #Log final speed and statistics log.info("finished %s at %s\n" % (convertSize( self.bytestotal), getSpeed(self.bytestotal, time.time() - self.st)))
def process(self): bitc = BitcasaClient("758ab3de", "5669c999ac340185a7c80c28d12a4319", "https://rose-llc.com/bitcasafilelist/", self.accesstoken) log.debug("Getting base folder") base = None while base is None: try: base = bitc.get_folder(self.basefolder) except (BitcasaException, ValueError) as e: log.error("Bitcasa API Exception: %s. Retrying" % e) time.sleep(10) # sleep here so that we don't exhaust api rate limit too fast except KeyboardInterrupt: raise SystemExit #initialize logfiles try: if not os.path.isdir(self.tmp): os.makedirs(self.tmp) except OSError as exc: pass myfile = file(self.successfiles, 'w+') myfile.write(time.strftime("%Y-%m-%d %H:%M:%S") + " Start\n") myfile.close() myfile = file(self.errorfiles, 'w+') myfile.write(time.strftime("%Y-%m-%d %H:%M:%S") + " Start\n") myfile.close() myfile = file(self.skippedfiles, 'w+') myfile.write(time.strftime("%Y-%m-%d %H:%M:%S") + " Start\n") myfile.close() log.debug("Starting recursion") self.folderRecurse(base, "", 0, 0) #wait for threads to finish downoading for thread in self.threads: thread.join() #Log final speed and statistics log.info("finished %s at %s\n" % (convertSize(self.bytestotal), getSpeed(self.bytestotal, time.time() - self.st)))