Scrapy Syntax and Parameters

Scrapy follows a particular syntax in which it accepts quite a number of parameters mentioned and explained below,

Syntax: yield scrapy.Request(url, callback, method=’GET’, headers=None, body=None)

Parameter:

As you can see the above code line is a typical Scrapy Request with its parameters which are,

  1. `url`: This is the URL of the website you want to scrape.
  2. `callback`: The method or handler that will process the response received
  3. `method`: This is an optional parameter that represents the HTTP method to be used.
  4. `headers`: Again an optional parameter this includes the header in the request. 
  5. `body`: This refers to the request body mostly used while performing a POST request.

Scrapy – Requests and Responses

In this article, we will explore the Request and Response-ability of Scrapy through a demonstration in which we will scrape some data from a website using Scrapy request and process that scraped data from Scrapy response. 

Similar Reads

Scrapy – Requests and Responses

The Scrapy Framework, built using Python, is one of the most popular open-source web crawling frameworks. The motivation behind Scrapy is to make searching through large Web pages and extraction of data efficient and easy. No matter the size or complexity of the website, Scrapy is capable of crawling any website. One of the core features of Scrapy is its ability to send HTTP requests and handle the respective responses....

Scrapy Syntax and Parameters

Scrapy follows a particular syntax in which it accepts quite a number of parameters mentioned and explained below,...

Making Requests using Scrapy

Now, when sending Requests using Scrapy, we send a Request object which represents an HTTP request sent to a website. To understand the requests in Scrapy let’s consider the following example,...

Handling Responses

...

Contact Us