[英]scrapy ,Why does the scrapy.Request class call the parse() method by default?
[英]Scrapy.Request() doesn't work in parse method
我在Spider-Class中遇到以下代碼問題:
def parse(self, response):
item = ResponseItem();
item['url'] = response.headers["Location"]
item['status'] = response.status
filename = response.url.split("/")[-2] + '.txt'
with open (filename, 'wb') as f:
f.write("%r" %response.status)
f.write("\r\n")
f.write("%s" %item['url'])
return scrapy.Request("http://www.google.com/", callback=self.testparse)
def testparse(self, response): ...
Scrapy / Python不執行parse-Method中定義的Request。 我對Scrapy和Python很陌生,所以有人能告訴我,我做錯了嗎?
(請求URL只是一個例子)
很抱歉我遲到了,但我找到了解決辦法。 我忘了設置正確允許的域名...
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.