Only make HEAD request when using crawling framework Scrapy

Question:

When using the crawling framework Scrapy in Python, I want only to check the HTML response codes of a few thousand domains – and nothing else to do a fast and efficient initial crawling for status code.

How can I only do HEAD Requests instead of the default GET request?

Asked By: Alex

||

Answers:

you can use the method option in Request

def start_requests(self):
    yield scrapy.Request(
        url,
        method="HEAD"
    )
Answered By: zaki98
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.