user1803095
user1803095

Reputation: 89

Scrapy log.info in function

It seems that Scrapy doesn't display log.info when calling callback. My code:

import scrapy
import re
from array import *
import platform
print("version :"+platform.python_version())

class QuotesSpider(scrapy.Spider):
    name = "test"
    start_urls = [
           'https://www.google.com'
           ]

    def parse(self, response):
        self.logger.info("before callback")
        scrapy.Request("http://www.google.de", callback=self.parseOther)
        self.logger.info("after parseOther")
        return

    def parseOther(self, response):
      self.logger.info("##################parseOther#######################")         
        return

Maybe the callback is not executed. Any suggestions? Thanks

Upvotes: 0

Views: 50

Answers (1)

stranac
stranac

Reputation: 28226

Creating a Request is not enough for it to actually be sent.
You need to yield it, just like you would yield items.

yield scrapy.Request("http://www.google.de", callback=self.parseOther)

Upvotes: 1

Related Questions