Issue 1:
Description

Running on MacOS 12.2.1,

Scrapy 2.6.2 breaks with SSL error:

2022-09-26 15:22:01 [twisted] CRITICAL:
Traceback (most recent call last):
File "/Users/barney/git/netail_code/netail-crawling-infra/crawling/netail-crawler/.venv/lib/python3.10/site-packages/twisted/internet/defer.py", line 1696, in _inlineCallbacks
result = context.run(gen.send, result)
File "/Users/barney/git/netail_code/netail-crawling-infra/crawling/netail-crawler/.venv/lib/python3.10/site-packages/scrapy/crawler.py", line 101, in crawl
self.engine = self._create_engine()
File "/Users/barney/git/netail_code/netail-crawling-infra/crawling/netail-crawler/.venv/lib/python3.10/site-packages/scrapy/crawler.py", line 115, in _create_engine
return ExecutionEngine(self, lambda _: self.stop())
File "/Users/barney/git/netail_code/netail-crawling-infra/crawling/netail-crawler/.venv/lib/python3.10/site-packages/scrapy/core/engine.py", line 83, in __init__
self.downloader = downloader_cls(crawler)
File "/Users/barney/git/netail_code/netail-crawling-infra/crawling/netail-crawler/.venv/lib/python3.10/site-packages/scrapy/core/downloader/__init__.py", line 83, in __init__
self.middleware = DownloaderMiddlewareManager.from_crawler(crawler)
File "/Users/barney/git/netail_code/netail-crawling-infra/crawling/netail-crawler/.venv/lib/python3.10/site-packages/scrapy/middleware.py", line 59, in from_crawler
return cls.from_settings(crawler.settings, crawler)
File "/Users/barney/git/netail_code/netail-crawling-infra/crawling/netail-crawler/.venv/lib/python3.10/site-packages/scrapy/middleware.py", line 40, in from_settings
mwcls = load_object(clspath)
File "/Users/barney/git/netail_code/netail-crawling-infra/crawling/netail-crawler/.venv/lib/python3.10/site-packages/scrapy/utils/misc.py", line 61, in load_object
mod = import_module(module)
File "/Users/barney/.pyenv/versions/3.10.2/lib/python3.10/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 883, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/Users/barney/git/netail_code/netail-crawling-infra/crawling/netail-crawler/.venv/lib/python3.10/site-packages/scrapy/downloadermiddlewares/retry.py", line 27, in <module>
from scrapy.core.downloader.handlers.http11 import TunnelError
File "/Users/barney/git/netail_code/netail-crawling-infra/crawling/netail-crawler/.venv/lib/python3.10/site-packages/scrapy/core/downloader/handlers/http11.py", line 23, in <module>
from scrapy.core.downloader.contextfactory import load_context_factory_from_settings
File "/Users/barney/git/netail_code/netail-crawling-infra/crawling/netail-crawler/.venv/lib/python3.10/site-packages/scrapy/core/downloader/contextfactory.py", line 11, in <module>
from scrapy.core.downloader.tls import DEFAULT_CIPHERS, openssl_methods, ScrapyClientTLSOptions
File "/Users/barney/git/netail_code/netail-crawling-infra/crawling/netail-crawler/.venv/lib/python3.10/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'

I suspect this error is because PyOpenSSL pushed a new release that pins to cryptography>=38.0.0,<39 (see: https://github.com/pyca/pyopenssl/pull/1150/files, and https://github.com/pyca/pyopenssl/blob/main/setup.py#L99), as downgrading to cryptography>38 removes this error entirely.

Steps to Reproduce

Install scrapy == 2.6.2 on fresh virtualenv

Run scrapy

See error

Downgrade cryptography<38

Error goes.

Expected behavior: [What you expect to happen]

Actual behavior: [What actually happens]

Reproduces how often: [What percentage of the time does it reproduce?]

Versions

.venv ❯ scrapy version --verbose
Scrapy : 2.6.2
lxml : 4.9.1.0
libxml2 : 2.9.4
cssselect : 1.1.0
parsel : 1.6.0
w3lib : 2.0.1
Twisted : 22.8.0
Python : 3.10.2 (main, Mar 25 2022, 12:18:40) [Clang 13.1.6 (clang-1316.0.21.2)]
pyOpenSSL : 22.1.0 (OpenSSL 3.0.5 5 Jul 2022)
cryptography : 38.0.1
Platform : macOS-12.2.1-arm64-arm-64bit

Additional context

Any additional information, configuration, data or output from commands that might be necessary to reproduce or understand the issue. Please try not to include screenshots of code or the command line, paste the contents as text instead. You can use GitHub Flavored Markdown to make the text look better.

Issue 2:
WHAT THE F

does not exist in pyopenssl

no help anywhere