Exemple #1
0
class debug_Reptile:
    def __init__(self):
        homeUrls = [
            'http://www.cau.edu.cn',
            'http://google.com.hk',
            'http://www.baidu.com',
        ]
        self.urlQueue = Queue()
        self.urlist = List()
        self.urlInQueue = UrlQueue(len(homeUrls))
        self.continueRun = [True]
        self.curSiteID = [0]

        self.reptile = Reptile(
            name = "reptile", 
            urlQueue = self.urlQueue,
            urlist = self.urlist,
            urlInQueue = self.urlInQueue,
            Flock = None,
            homeUrls = homeUrls,
            curSiteID = self.curSiteID,
            continueRun = self.continueRun
        )

    @dec
    def conn(self):
        print "conn"
        print self.reptile.conn()

    def requestSource(self):
        pass

    def getPage(self):
        data = self.reptile.getPage('')
        print 'data'
        print data

    @dec
    def run(self):
        url = ["中国农业大学", '']
        self.urlQueue.put(url)
        self.reptile.run()
Exemple #2
0
    def __init__(self):
        homeUrls = [
            'http://www.cau.edu.cn',
            'http://google.com.hk',
            'http://www.baidu.com',
        ]
        self.urlQueue = Queue()
        self.urlist = List()
        self.urlInQueue = UrlQueue(len(homeUrls))
        self.continueRun = [True]
        self.curSiteID = [0]

        self.reptile = Reptile(
            name = "reptile", 
            urlQueue = self.urlQueue,
            urlist = self.urlist,
            urlInQueue = self.urlInQueue,
            Flock = None,
            homeUrls = homeUrls,
            curSiteID = self.curSiteID,
            continueRun = self.continueRun
        )