Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/02_guides/code/scrapy_project/src/__main__.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from __future__ import annotations

from twisted.internet import asyncioreactor
from scrapy.utils.reactor import install_reactor

# Install Twisted's asyncio reactor before importing any other Twisted or
# Scrapy components.
asyncioreactor.install() # type: ignore[no-untyped-call]
install_reactor('twisted.internet.asyncioreactor.AsyncioSelectorReactor')

import os

Expand Down
1 change: 1 addition & 0 deletions docs/02_guides/code/scrapy_project/src/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
ROBOTSTXT_OBEY = True
SPIDER_MODULES = ['src.spiders']
TELNETCONSOLE_ENABLED = False
# Do not change the Twisted reactor unless you really know what you are doing.
TWISTED_REACTOR = 'twisted.internet.asyncioreactor.AsyncioSelectorReactor'
2 changes: 2 additions & 0 deletions docs/02_guides/code/scrapy_project/src/spiders/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
from .title import TitleSpider

__all__ = ['TitleSpider']
2 changes: 1 addition & 1 deletion docs/02_guides/code/scrapy_project/src/spiders/title.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
if TYPE_CHECKING:
from collections.abc import Generator

from scrapy.responsetypes import Response
from scrapy.http.response import Response


class TitleSpider(Spider):
Expand Down
Loading