J
J
jiamak2018-06-15 10:53:32
Python
jiamak, 2018-06-15 10:53:32

Scrapy requests in a loop with a delay?

The idea is that after authorization on the site, you need to make the same request with a delay of 1 minute, how to implement this?
How to implement this kind of logic:

import scrapy
import time
class ParseSpider(scrapy.Spider):
    def start(self):
        return scrapy.FormRequest(url='example.com',
                                    formdata=data,
                                    callback=self.nextRequest)

    def nextRequest(self, response):
        while True:
            time.sleep(60)

            yield scrapy.FormRequest(url='requestForm.com',
                                        formdata=data,
                                        callback=self.res)
    
    def res(self, response):
        ....

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
planc, 2018-06-15
@planc

https://doc.scrapy.org/en/latest/topics/settings.h...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question