W3Cschool
恭喜您成為首批注冊用戶
獲得88經驗值獎勵
而 parse 命令對于檢查蜘蛛的行為非常有用,除了顯示接收到的響應和輸出之外,檢查回調中發(fā)生的情況幾乎沒有幫助。如何調試情況 parse_details 有時沒有收到物品?
幸運的是, shell 在這種情況下,你的面包和黃油(見 從spiders調用shell來檢查響應 ):
from scrapy.shell import inspect_response
def parse_details(self, response, item=None):
if item:
# populate more `item` fields
return item
else:
inspect_response(response, self)
Copyright©2021 w3cschool編程獅|閩ICP備15016281號-3|閩公網安備35020302033924號
違法和不良信息舉報電話:173-0602-2364|舉報郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號
聯(lián)系方式:
更多建議: