예제 #1
0
class Downloader(threading.Thread):
    def __init__(self, queue):
        threading.Thread.__init__(self)
        self.q = queue
        self.logger = logging.getLogger('Pindel')
        self.srm = SRMClient(self.logger)
        self.daemon = False
    
    def run(self):
        while not self.q.empty():
            f = self.q.get()
            count = 0
            done = False
            while(count < 10 and not done):
                try:
                    self.srm.download(f)
                    done = True
                except:
                    count += 1
            if(count > 9):
                raise EnvironmentError("Download failed.")
            self.q.task_done()
        print "Exeting while loop, thread should close itself..."
예제 #2
0
class Downloader(threading.Thread):
    def __init__(self, queue):
        threading.Thread.__init__(self)
        self.q = queue
        self.logger = logging.getLogger('Pindel')
        self.srm = SRMClient(self.logger)
        self.daemon = False

    def run(self):
        while not self.q.empty():
            f = self.q.get()
            count = 0
            done = False
            while (count < 10 and not done):
                try:
                    self.srm.download(f)
                    done = True
                except:
                    count += 1
            if (count > 9):
                raise EnvironmentError("Download failed.")
            self.q.task_done()
        print "Exeting while loop, thread should close itself..."
예제 #3
0
 def __init__(self, queue):
     threading.Thread.__init__(self)
     self.q = queue
     self.logger = logging.getLogger('Pindel')
     self.srm = SRMClient(self.logger)
     self.daemon = False
예제 #4
0
 def __init__(self, queue):
     threading.Thread.__init__(self)
     self.q = queue
     self.logger = logging.getLogger('Pindel')
     self.srm = SRMClient(self.logger)
     self.daemon = False