在使用定义的url运行scrapy shell后,我得到了显示以下错误的属性错误:属性错误:模块“OpenSSL.SSL”没有属性“SSLv3_METHOD”scrapy shell "https://quotes.toscrape.com/tag/humor/"
有人能帮我解决这个错误吗?
2022-09-27 01:38:38 [scrapy.utils.log] INFO: Versions: lxml 4.9.1.0, libxml2 2.9.12, cssselect 1.1.0, parsel 1.6.0, w3lib 2.0.1, Twisted 22.8.0, Python 3.9.2 (tags/v3.9.2:1a79785, Feb 19 2021, 13:44:55) [MSC v.1928 64 bit (AMD64)], pyOpenSSL 22.1.0 (OpenSSL 3.0.5 5 Jul 2022), cryptography 38.0.1, Platform Windows-10-10.0.19041-SP0
2022-09-27 01:38:38 [scrapy.crawler] INFO: Overridden settings:
{'DUPEFILTER_CLASS': 'scrapy.dupefilters.BaseDupeFilter',
'LOGSTATS_INTERVAL': 0}
2022-09-27 01:38:38 [scrapy.utils.log] DEBUG: Using reactor: twisted.internet.selectreactor.SelectReactor
2022-09-27 01:38:38 [scrapy.extensions.telnet] INFO: Telnet Password: d760ab2d8573ec57
2022-09-27 01:38:38 [scrapy.middleware] INFO: Enabled extensions:
['scrapy.extensions.corestats.CoreStats',
'scrapy.extensions.telnet.TelnetConsole']
2022-09-27 01:38:39 [scrapy.core.downloader.handlers] ERROR: Loading "scrapy.core.downloader.handlers.http.HTTPDownloadHandler" for scheme "http"
Traceback (most recent call last):
File "d:\python\scraping-project\scrapy\venv\lib\site-packages\scrapy\core\downloader\handlers\__init__.py", line 49, in _load_handler
dhcls = load_object(path)
File "d:\python\scraping-project\scrapy\venv\lib\site-packages\scrapy\utils\misc.py", line 61, in load_object
mod = import_module(module)
File "C:\Users\DELL\AppData\Local\Programs\Python\Python39\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1030, in _gcd_import
File "<frozen importlib._bootstrap>", line 1007, in _find_and_load
File "<frozen importlib._bootstrap>", line 986, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 680, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 790, in exec_module
File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
File "d:\python\scraping-project\scrapy\venv\lib\site-packages\scrapy\core\downloader\handlers\http.py", line 2, in <module>
from scrapy.core.downloader.handlers.http11 import (
File "d:\python\scraping-project\scrapy\venv\lib\site-packages\scrapy\core\downloader\handlers\http11.py", line 23, in <module>
from scrapy.core.downloader.contextfactory import load_context_factory_from_settings
File "d:\python\scraping-project\scrapy\venv\lib\site-packages\scrapy\core\downloader\contextfactory.py", line 11, in <module>
from scrapy.core.downloader.tls import DEFAULT_CIPHERS, openssl_methods, ScrapyClientTLSOptions
File "d:\python\scraping-project\scrapy\venv\lib\site-packages\scrapy\core\downloader\tls.py", line 23, in <module>
METHOD_SSLv3: SSL.SSLv3_METHOD, # SSL 3 (NOT recommended)
AttributeError: module 'OpenSSL.SSL' has no attribute 'SSLv3_METHOD'
3条答案
按热度按时间r55awzrz1#
我也有同样的问题,我用这个解决了它:
xj3cbfub2#
我认为这是由于通过
PyOpenSSL
更新了cryptography
--我记录了Scrapy(https://github.com/scrapy/scrapy/issues/5638)的问题,但对我有效的解决方法是降级cryptography
:r1zk6ea13#
我已经通过注解以下虚拟环境folder=〉
Lib\site-packages\scrapy\core\downloader\tls.py
=〉中的行解决了此问题,注解掉了METHOD_SSLv3:SSL.SSLv3_方法,