Exemplo n.º 1
0
 def schedule_spiders(self,project_name,spider_name):
     
     url = 'http://localhost:6800/schedule.json'
     curl = Curl(url)
     dic = {'project':project_name,'spider':spider_name}
     res = curl.post(dic)
     rlt = json.loads(res)
     if rlt['status'] == 'ok':
         return True
     else:
         return False
Exemplo n.º 2
0
 def run(self):
     f = open("/tmp/daemon-log","w")
     while True:
         res = self.check_spiders('soufun_agent')
         if res:
             f.write('%s' % res)
         else:
             f.write('starting the soufun_agent_spider\n')
             url = 'http://localhost:6800/schedule.json'
             curl =Curl(url)
             dic = {'project':'soufun_s2','spider':'soufun_agent'}
             res = curl.post(dic) 
         f.flush()
         time.sleep(10)