Registry / web-framework / scrapy

scrapy

JSON →
library2.18.0pypypi✓ verified 29d ago

Scrapy is a high-level Python web crawling and web scraping framework, designed for fast extraction of structured data from websites. It's actively maintained with frequent releases, supporting applications from data mining to information processing and automated testing. The current version is 2.15.0.

pip install scrapy
INSTALL
IMPORT
SIG · SCRAPY
S
scrapy
web-frameworkpythonv2.18.0
Install
7.8s avg
Import
1377ms
Disk
98MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.9–3.13
musl
3.9–3.13
Install & Compatibility
Where this runs
tested against v2.18.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 1.450s · 95.6MB
glibc
py 3.10–3.95 runs
installs and imports cleanly · install 7.8s · import 1.304s · 97MB
98MB installed
● package 98MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

scrapy
✓ import scrapy
Spider
✓ from scrapy import Spider
✗ from scrapy.spider import Spider
Importing Spider directly from scrapy is generally preferred and cleaner than from scrapy.spider.
Request
✓ from scrapy import Request
Item
✓ from scrapy import Item
Field
✓ from scrapy.item import Field
CrawlSpider
✓ from scrapy.spiders import CrawlSpider
LinkExtractor
✓ from scrapy.linkextractors import LinkExtractor
AsyncCrawlerProcess
✓ from scrapy.crawler import AsyncCrawlerProcess
Used for running Scrapy from scripts. AsyncCrawlerProcess returns coroutines, while CrawlerProcess returns Deferred objects.

This quickstart demonstrates a basic Scrapy spider that crawls the 'quotes.toscrape.com' website, specifically the 'humor' tag. It extracts the author and text of each quote, then follows the 'Next Page' link to continue crawling. The `start_urls` attribute defines the initial URLs, and the `parse` method handles the response, extracting data and scheduling new requests using `response.follow` for pagination.

import scrapy class QuotesSpider(scrapy.Spider): name = "quotes" start_urls = [ "https://quotes.toscrape.com/tag/humor/", ] def parse(self, response): for quote in response.css("div.quote"): yield { "author": quote.xpath("span/small/text()").get(), "text": quote.css("span.text::text").get(), } next_page = response.css('li.next a::attr("href")').get() if next_page is not None: yield response.follow(next_page, self.parse) # To run this spider, save it as a .py file (e.g., quotes_spider.py) and execute: # scrapy runspider quotes_spider.py -o quotes.jsonl
scrapy --version
Debug
Known issues
breakingScrapy has progressively dropped support for older Python versions. Scrapy 2.12.0 dropped Python 3.8 support, and Scrapy 2.14.0 dropped Python 3.9 and PyPy 3.10. Ensure your environment meets the `requires_python >=3.10` requirement.
fix
Upgrade to Python 3.10 or newer. Use a virtual environment for isolated Scrapy installations.
affects: >=2.12.0
breakingThe `start_requests()` (synchronous) method for yielding initial requests has been replaced by `start()` (asynchronous) in Scrapy 2.13.0, which is now the preferred way. While `start_urls` remains a shortcut, direct asynchronous operations for initial requests should use `async def start(self)`.
fix
Migrate `def start_requests(self)` to `async def start(self)` if you are performing asynchronous operations (e.g., database calls) to generate your initial requests.
affects: >=2.13.0
breakingThe asyncio reactor is now enabled by default starting from Scrapy 2.13.0. This might affect applications with existing Twisted-specific reactor setups or require updates for custom spider middlewares that do not explicitly support asynchronous output, which may now log warnings.
fix
Review and update custom middlewares to support asynchronous spider output by defining `process_spider_output` as an asynchronous generator or implementing `process_spider_output_async`.
affects: >=2.13.0
breakingScrapy 2.14.2 includes a security fix where values from the `Referrer-Policy` header of HTTP responses are no longer executed as Python callables. Additionally, 301 redirects of POST requests are now converted into GET requests, aligning with the HTTP standard.
fix
Do not rely on `Referrer-Policy` header values being executed as code. Be aware that POST requests resulting in 301 redirects will now be re-sent as GET requests.
affects: >=2.14.2
deprecated`scrapy.utils.defer.maybeDeferred_coro()` and other related `scrapy.utils.defer` functions (e.g., `mustbe_deferred`, `defer_succeed`, `defer_fail`) are deprecated in Scrapy 2.14.1. Users are encouraged to use direct Twisted functions or coroutines.
fix
Replace calls to `scrapy.utils.defer` functions with their `twisted.internet.defer` equivalents or appropriate coroutine patterns. For `maybeDeferred_coro()`, consider `twisted.internet.defer.maybeDeferred` if staying with Deferreds.
affects: >=2.14.1
gotchaRequest and Response objects now define `__slots__`, meaning you cannot assign arbitrary attributes directly (e.g., `response.foo = 1`). Attempting to do so will raise an `AttributeError`.
fix
Store per-request/response data in the `request.meta` or `request.cb_kwargs` mappings instead of attaching new attributes to the objects.
affects: >=2.15.0
gotchaIn Scrapy 2.13.3, the default project template changed the values for `DOWNLOAD_DELAY` (from 0 to 1 second) and `CONCURRENT_REQUESTS_PER_DOMAIN` (from 8 to 1) to promote more polite crawling. New projects will inherit these slower defaults.
fix
Adjust `DOWNLOAD_DELAY` and `CONCURRENT_REQUESTS_PER_DOMAIN` in your `settings.py` if you require higher concurrency or a faster crawl rate for your specific use case.
affects: >=2.13.3
Errors
Common errors & fixes
scrapy: command not found
The Scrapy command-line tool is not found in your system's PATH, usually because Scrapy was not installed or the correct virtual environment is not active.
fix
Ensure Scrapy is installed with `pip install scrapy` and that your shell's PATH includes the directory where Scrapy executables are located, or activate your Python virtual environment.
ModuleNotFoundError: No module named 'scrapy'
The Scrapy library is not installed in the Python environment currently being used or the environment is not properly activated.
fix
Install Scrapy using pip: `pip install scrapy`.
ImportError: cannot import name 'BaseSpider' from 'scrapy.spider'
`BaseSpider` was deprecated and removed in Scrapy 1.0 and later versions; `Spider` should be imported directly from the top-level `scrapy` package.
fix
Replace `from scrapy.spider import BaseSpider` with `from scrapy import Spider`.
TypeError: Can't instantiate abstract class Spider with abstract method parse
Your spider class inherits from `scrapy.Spider` but does not implement the mandatory `parse` method, which is the default callback for handling initial requests.
fix
Define a `parse` method in your spider class with `def parse(self, response):` and include your scraping logic there.
twisted.internet.error.ReactorAlreadyRunning: reactor already installed
This error occurs when attempting to start the Twisted event loop (reactor) multiple times within the same Python process, typically when embedding Scrapy or running multiple spiders sequentially without proper management.
fix
When embedding Scrapy, use `CrawlerProcess` or `CrawlerRunner` and ensure the reactor is managed properly; avoid calling `reactor.run()` explicitly after `process.start()` or for each spider run.
Upgrade
Version history
2.18.0latest on PyPI · released Aug 20, 2026
Audit
Dependencies
TwistedrequiredAsynchronous networking framework, core dependency. Scrapy 2.15.0 adds experimental support for running without a Twisted reactor.
lxmlrequiredEfficient XML and HTML parser.
parselrequiredHTML/XML data extraction library built on lxml.
w3librequiredMulti-purpose helper for URLs and web page encodings.
cryptographyrequiredDeals with network-level security needs.
pyOpenSSLrequiredDeals with network-level security needs.
brotlirequiredRequired (>=1.2.0) for improved protection against decompression bombs in HttpCompressionMiddleware since Scrapy 2.13.4.
httpxoptionalExperimental HTTPX-based download handler in Scrapy 2.15.0.
Agent activity
30 hits · last 30 days
node
24
Amazon
1
OpenAI (training)
1
Resources
scrapy — pip install scrapy · libregistry