1

I am trying to set random time interval and call that function between iteration in python/scrapy

Note: How to set Random time interval between iteration and function in python scrapy

import random


class MySpider(CrawlSpider):

 def xxxxxx(self):
       xxxxxx

 def xxxx(self,response):
  for list in lists:
                        
  for xxxxxxx:
                          item = example()
                          yield request
        
        
 def xxxxxx(self, response):
  item=response.meta['item']
 
  return item
Karthick
  • 33
  • 1
  • 1
  • 7

1 Answers1

0

Maybe this could work as scrapy is a framwork based on twisted

import random
from twisted.internet import reactor

INTERVAL = xxxx
def callRandomTime():
    youFunc()
    reactor.callLater(INTERVAL * random.random(), callRandomTime)
zczhuohuo
  • 169
  • 1
  • 13