Skip to content

Scrapy, a fast high-level web crawling & scraping framework for Python.

Ignore HTTPS certificate verification failures

Paul Trembertha087d2593a36
diff --git a/scrapy/core/downloader/contextfactory.py b/scrapy/core/downloader/contextfactory.py
index 09fcd491a..3e147ae36 100644
--- a/scrapy/core/downloader/contextfactory.py
+++ b/scrapy/core/downloader/contextfactory.py
@@ -1,6 +1,7 @@
from OpenSSL import SSL
from twisted.internet.ssl import ClientContextFactory
+
try:
from zope.interface.declarations import implementer
@@ -11,6 +12,12 @@ try:
from twisted.web.client import BrowserLikePolicyForHTTPS
from twisted.web.iweb import IPolicyForHTTPS
+
+ class ScrapyClientTLSOptions(ClientTLSOptions):
+ def _identityVerifyingInfoCallback(self, connection, where, ret):
+ pass
+
+
@implementer(IPolicyForHTTPS)
class ScrapyClientContextFactory(BrowserLikePolicyForHTTPS):
"""
@@ -49,7 +56,7 @@ try:
return self.getCertificateOptions().getContext()
def creatorForNetloc(self, hostname, port):
- return ClientTLSOptions(hostname.decode("ascii"), self.getContext())
+ return ScrapyClientTLSOptions(hostname.decode("ascii"), self.getContext())
@implementer(IPolicyForHTTPS)