![](/img/trans.png)
[英]XPath expression not working in scrapy spider but it is scrapy shell
[英]Scrapy request, shell Fetch() in spider
我正在嘗試訪問特定頁面,我們稱其為http://example.com/puppers
。 當直接使用scrapy shell
或標准scrapy.request
模塊(結果為<405> HTTP
)連接時,無法訪問此頁面。
但是,當我先使用scrapy shell 'http://example.com/kittens'
,然后使用fetch('http://example.com/puppers')
它可以工作,並且我得到<200> OK HTTP
代碼。 我現在可以使用scrapy shell
提取數據。
我試着在我的腳本實現這一點,通過改變referer
(使用URL#1),在user-agent
和其他幾個人同時連接到puppers(URL#2)頁面。 我仍然收到<405>代碼。
我感謝所有的幫助。 謝謝。
start_urls = ['http://example.com/kittens']
def parse(self, response):
yield scrapy.Request(
url="http://example.com/puppers",
callback=self.parse_puppers
)
def parse_puppers(self, response):
#process your puppers
.....
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.