Scrapy, a fast high-level web crawling & scraping framework for Python.
Remove import check for service_identity
Eugenio Lacuestab404941e0de8
diff --git a/scrapy/core/downloader/tls.py b/scrapy/core/downloader/tls.pyindex 995f8cbba..1c3d94b29 100644--- a/scrapy/core/downloader/tls.py+++ b/scrapy/core/downloader/tls.py@@ -1,8 +1,9 @@import loggingfrom OpenSSL import SSL-from twisted.internet.ssl import AcceptableCiphers+from service_identity.exceptions import CertificateErrorfrom twisted.internet._sslverify import ClientTLSOptions, verifyHostname, VerificationError+from twisted.internet.ssl import AcceptableCiphersfrom scrapy import twisted_versionfrom scrapy.utils.ssl import x509name_to_string, get_temp_key_info@@ -27,15 +28,6 @@ openssl_methods = {}-try:- # XXX: this import would fail on Debian jessie with system installed- # service_identity library, due to lack of cryptography.x509 dependency- # See https://github.com/pyca/service_identity/issues/21- from service_identity.exceptions import CertificateError- verification_errors = (CertificateError, VerificationError)-except ImportError:- verification_errors = VerificationError-if twisted_version < (17, 0, 0):from twisted.internet._sslverify import _maybeSetHostNameIndicationset_tlsext_host_name = _maybeSetHostNameIndication@@ -87,7 +79,7 @@ class ScrapyClientTLSOptions(ClientTLSOptions):try:verifyHostname(connection, self._hostnameASCII)- except verification_errors as e:+ except (CertificateError, VerificationError) as e:logger.warning('Remote certificate is not valid for hostname "{}"; {}'.format(self._hostnameASCII, e))