Skip to content

Commit 704487b

Browse files
committed
Add missing import check to ApifyHttpProxyMiddleware
1 parent 3f0f6ef commit 704487b

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/apify/scrapy/middlewares/apify_proxy.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,13 @@
33
from typing import TYPE_CHECKING
44
from urllib.parse import ParseResult, urlparse
55

6-
from scrapy.core.downloader.handlers.http11 import TunnelError
7-
from scrapy.exceptions import NotConfigured
6+
try:
7+
from scrapy.core.downloader.handlers.http11 import TunnelError
8+
from scrapy.exceptions import NotConfigured
9+
except ImportError as exc:
10+
raise ImportError(
11+
'To use this module, you need to install the "scrapy" extra. Run "pip install apify[scrapy]".',
12+
) from exc
813

914
from ...actor import Actor
1015
from ...proxy_configuration import ProxyConfiguration

0 commit comments

Comments
 (0)